mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-04 05:43:06 +00:00
fix: remove deprecated and never used topic descriptors (#423)
fixes #264
This commit is contained in:
parent
0094708cc4
commit
6195a09441
960
pb/rpc.pb.go
960
pb/rpc.pb.go
File diff suppressed because it is too large
Load Diff
30
pb/rpc.proto
30
pb/rpc.proto
@ -54,32 +54,4 @@ message ControlPrune {
|
|||||||
message PeerInfo {
|
message PeerInfo {
|
||||||
optional bytes peerID = 1;
|
optional bytes peerID = 1;
|
||||||
optional bytes signedPeerRecord = 2;
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
115
pb/trace.pb.go
115
pb/trace.pb.go
@ -3896,10 +3896,7 @@ func (m *TraceEvent) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -4017,10 +4014,7 @@ func (m *TraceEvent_PublishMessage) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -4205,10 +4199,7 @@ func (m *TraceEvent_RejectMessage) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -4360,10 +4351,7 @@ func (m *TraceEvent_DuplicateMessage) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -4515,10 +4503,7 @@ func (m *TraceEvent_DeliverMessage) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -4636,10 +4621,7 @@ func (m *TraceEvent_AddPeer) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -4724,10 +4706,7 @@ func (m *TraceEvent_RemovePeer) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -4848,10 +4827,7 @@ func (m *TraceEvent_RecvRPC) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -4972,10 +4948,7 @@ func (m *TraceEvent_SendRPC) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -5096,10 +5069,7 @@ func (m *TraceEvent_DropRPC) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -5183,10 +5153,7 @@ func (m *TraceEvent_Join) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -5270,10 +5237,7 @@ func (m *TraceEvent_Leave) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -5391,10 +5355,7 @@ func (m *TraceEvent_Graft) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -5512,10 +5473,7 @@ func (m *TraceEvent_Prune) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -5670,10 +5628,7 @@ func (m *TraceEvent_RPCMeta) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -5791,10 +5746,7 @@ func (m *TraceEvent_MessageMeta) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -5899,10 +5851,7 @@ func (m *TraceEvent_SubMeta) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -6089,10 +6038,7 @@ func (m *TraceEvent_ControlMeta) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -6208,10 +6154,7 @@ func (m *TraceEvent_ControlIHaveMeta) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -6294,10 +6237,7 @@ func (m *TraceEvent_ControlIWantMeta) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -6381,10 +6321,7 @@ func (m *TraceEvent_ControlGraftMeta) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -6500,10 +6437,7 @@ func (m *TraceEvent_ControlPruneMeta) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
@ -6588,10 +6522,7 @@ func (m *TraceEventBatch) Unmarshal(dAtA []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if skippy < 0 {
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
return ErrInvalidLengthTrace
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTrace
|
return ErrInvalidLengthTrace
|
||||||
}
|
}
|
||||||
if (iNdEx + skippy) > l {
|
if (iNdEx + skippy) > l {
|
||||||
|
|||||||
21
pubsub.go
21
pubsub.go
@ -1141,30 +1141,13 @@ type SubOpt func(sub *Subscription) error
|
|||||||
//
|
//
|
||||||
// Deprecated: use pubsub.Join() and topic.Subscribe() instead
|
// Deprecated: use pubsub.Join() and topic.Subscribe() instead
|
||||||
func (p *PubSub) Subscribe(topic string, opts ...SubOpt) (*Subscription, error) {
|
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
|
// ignore whether the topic was newly created or not, since either way we have a valid topic to work with
|
||||||
topic, _, err := p.tryJoin(td.GetName())
|
topicHandle, _, err := p.tryJoin(topic)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return topic.Subscribe(opts...)
|
return topicHandle.Subscribe(opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
type topicReq struct {
|
type topicReq struct {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user