Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-pubsub
Commits
6195a094
Unverified
Commit
6195a094
authored
May 11, 2021
by
Steven Allen
Committed by
GitHub
May 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: remove deprecated and never used topic descriptors (#423)
fixes #264
parent
0094708c
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
1062 deletions
+68
-1062
pb/rpc.pb.go
pb/rpc.pb.go
+42
-922
pb/rpc.proto
pb/rpc.proto
+1
-29
pb/trace.pb.go
pb/trace.pb.go
+23
-92
pubsub.go
pubsub.go
+2
-19
No files found.
pb/rpc.pb.go
View file @
6195a094
This diff is collapsed.
Click to expand it.
pb/rpc.proto
View file @
6195a094
...
...
@@ -54,32 +54,4 @@ message ControlPrune {
message
PeerInfo
{
optional
bytes
peerID
=
1
;
optional
bytes
signedPeerRecord
=
2
;
}
message
TopicDescriptor
{
optional
string
name
=
1
;
optional
AuthOpts
auth
=
2
;
optional
EncOpts
enc
=
3
;
message
AuthOpts
{
optional
AuthMode
mode
=
1
;
repeated
bytes
keys
=
2
;
// root keys to trust
enum
AuthMode
{
NONE
=
0
;
// no authentication, anyone can publish
KEY
=
1
;
// only messages signed by keys in the topic descriptor are accepted
WOT
=
2
;
// web of trust, certificates can allow publisher set to grow
}
}
message
EncOpts
{
optional
EncMode
mode
=
1
;
repeated
bytes
keyHashes
=
2
;
// the hashes of the shared keys used (salted)
enum
EncMode
{
NONE
=
0
;
// no encryption, anyone can read
SHAREDKEY
=
1
;
// messages are encrypted with shared key
WOT
=
2
;
// web of trust, certificates can allow publisher set to grow
}
}
}
}
\ No newline at end of file
pb/trace.pb.go
View file @
6195a094
...
...
@@ -3896,10 +3896,7 @@ func (m *TraceEvent) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -4017,10 +4014,7 @@ func (m *TraceEvent_PublishMessage) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -4205,10 +4199,7 @@ func (m *TraceEvent_RejectMessage) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -4360,10 +4351,7 @@ func (m *TraceEvent_DuplicateMessage) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -4515,10 +4503,7 @@ func (m *TraceEvent_DeliverMessage) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -4636,10 +4621,7 @@ func (m *TraceEvent_AddPeer) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -4724,10 +4706,7 @@ func (m *TraceEvent_RemovePeer) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -4848,10 +4827,7 @@ func (m *TraceEvent_RecvRPC) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -4972,10 +4948,7 @@ func (m *TraceEvent_SendRPC) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -5096,10 +5069,7 @@ func (m *TraceEvent_DropRPC) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -5183,10 +5153,7 @@ func (m *TraceEvent_Join) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -5270,10 +5237,7 @@ func (m *TraceEvent_Leave) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -5391,10 +5355,7 @@ func (m *TraceEvent_Graft) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -5512,10 +5473,7 @@ func (m *TraceEvent_Prune) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -5670,10 +5628,7 @@ func (m *TraceEvent_RPCMeta) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -5791,10 +5746,7 @@ func (m *TraceEvent_MessageMeta) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -5899,10 +5851,7 @@ func (m *TraceEvent_SubMeta) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -6089,10 +6038,7 @@ func (m *TraceEvent_ControlMeta) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -6208,10 +6154,7 @@ func (m *TraceEvent_ControlIHaveMeta) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -6294,10 +6237,7 @@ func (m *TraceEvent_ControlIWantMeta) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -6381,10 +6321,7 @@ func (m *TraceEvent_ControlGraftMeta) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -6500,10 +6437,7 @@ func (m *TraceEvent_ControlPruneMeta) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
@@ -6588,10 +6522,7 @@ func (m *TraceEventBatch) Unmarshal(dAtA []byte) error {
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) < 0 {
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTrace
}
if (iNdEx + skippy) > l {
...
...
pubsub.go
View file @
6195a094
...
...
@@ -1141,30 +1141,13 @@ type SubOpt func(sub *Subscription) error
//
// Deprecated: use pubsub.Join() and topic.Subscribe() instead
func
(
p
*
PubSub
)
Subscribe
(
topic
string
,
opts
...
SubOpt
)
(
*
Subscription
,
error
)
{
td
:=
pb
.
TopicDescriptor
{
Name
:
&
topic
}
return
p
.
SubscribeByTopicDescriptor
(
&
td
,
opts
...
)
}
// SubscribeByTopicDescriptor lets you subscribe a topic using a pb.TopicDescriptor.
//
// Deprecated: use pubsub.Join() and topic.Subscribe() instead
func
(
p
*
PubSub
)
SubscribeByTopicDescriptor
(
td
*
pb
.
TopicDescriptor
,
opts
...
SubOpt
)
(
*
Subscription
,
error
)
{
if
td
.
GetAuth
()
.
GetMode
()
!=
pb
.
TopicDescriptor_AuthOpts_NONE
{
return
nil
,
fmt
.
Errorf
(
"auth mode not yet supported"
)
}
if
td
.
GetEnc
()
.
GetMode
()
!=
pb
.
TopicDescriptor_EncOpts_NONE
{
return
nil
,
fmt
.
Errorf
(
"encryption mode not yet supported"
)
}
// ignore whether the topic was newly created or not, since either way we have a valid topic to work with
topic
,
_
,
err
:=
p
.
tryJoin
(
t
d
.
GetName
()
)
topic
Handle
,
_
,
err
:=
p
.
tryJoin
(
t
opic
)
if
err
!=
nil
{
return
nil
,
err
}
return
topic
.
Subscribe
(
opts
...
)
return
topic
Handle
.
Subscribe
(
opts
...
)
}
type
topicReq
struct
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment