Documentation ¶
Index ¶
- type Config
- func (c *Config) ApplyDefaults(protocolIds []protocol.ID) *Config
- func (c *Config) BuildServer(b bus.Bus, le *logrus.Entry, info *controller.Info, registerFns []RegisterFn) (*Server, error)
- func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Config) CloneVT() *Config
- func (this *Config) EqualMessageVT(thatMsg any) bool
- func (this *Config) EqualVT(that *Config) bool
- func (c *Config) GetDebugVals() config.DebugValues
- func (x *Config) GetDisableEstablishLink() bool
- func (x *Config) GetPeerIds() []string
- func (x *Config) GetProtocolIds() []string
- func (x *Config) MarshalJSON() ([]byte, error)
- func (x *Config) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config) MarshalProtoText() string
- func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Config) MarshalToVT(dAtA []byte) (int, error)
- func (m *Config) MarshalVT() (dAtA []byte, err error)
- func (c *Config) ParsePeerIDs() ([]peer.ID, error)
- func (c *Config) ParseProtocolIDs() ([]protocol.ID, error)
- func (*Config) ProtoMessage()
- func (x *Config) Reset()
- func (m *Config) SizeVT() (n int)
- func (x *Config) String() string
- func (x *Config) UnmarshalJSON(b []byte) error
- func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Config) UnmarshalVT(dAtA []byte) error
- func (c *Config) Validate() error
- type RegisterFn
- type Server
- func (s *Server) Close() error
- func (s *Server) Execute(ctx context.Context) error
- func (s *Server) GetControllerInfo() *controller.Info
- func (s *Server) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
- func (s *Server) HandleMountedStream(ctx context.Context, ms link.MountedStream) error
- func (s *Server) ResolveHandleMountedStream(ctx context.Context, di directive.Instance, dir link.HandleMountedStream) ([]directive.Resolver, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // PeerIds are the list of peer IDs to listen on. // If empty, allows any incoming peer id w/ the protocol id(s). PeerIds []string `protobuf:"bytes,1,rep,name=peer_ids,json=peerIds,proto3" json:"peerIds,omitempty"` // ProtocolIds is the list of protocol ids to listen on. // If empty, no incoming streams will be accepted. ProtocolIds []string `protobuf:"bytes,2,rep,name=protocol_ids,json=protocolIds,proto3" json:"protocolIds,omitempty"` // DisableEstablishLink disables adding an EstablishLink directive for each incoming peer. DisableEstablishLink bool `protobuf:"varint,3,opt,name=disable_establish_link,json=disableEstablishLink,proto3" json:"disableEstablishLink,omitempty"` // contains filtered or unexported fields }
Config configures the server for the srpc service.
func (*Config) ApplyDefaults ¶ added in v0.22.2
ApplyDefaults applies defaults to the config, returning a clone.
If the fields are set, skips the defaults.
func (*Config) BuildServer ¶ added in v0.22.2
func (c *Config) BuildServer(b bus.Bus, le *logrus.Entry, info *controller.Info, registerFns []RegisterFn) (*Server, error)
BuildServer constructs the server from the args.
func (*Config) CloneMessageVT ¶ added in v0.15.6
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Config) EqualMessageVT ¶ added in v0.15.6
func (*Config) GetDebugVals ¶ added in v0.20.2
func (c *Config) GetDebugVals() config.DebugValues
GetDebugVals returns the directive arguments as key/value pairs. This should be something like param1="test", param2="test". This is not necessarily unique, and is primarily intended for display.
func (*Config) GetDisableEstablishLink ¶ added in v0.22.2
func (*Config) GetPeerIds ¶
func (*Config) GetProtocolIds ¶ added in v0.20.2
func (*Config) MarshalJSON ¶ added in v0.29.0
MarshalJSON marshals the Config to JSON.
func (*Config) MarshalProtoJSON ¶ added in v0.29.0
func (x *Config) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config message to JSON.
func (*Config) MarshalProtoText ¶ added in v0.29.2
func (*Config) MarshalToSizedBufferVT ¶
func (*Config) ParsePeerIDs ¶
ParsePeerIDs parses the peer ids field.
func (*Config) ParseProtocolIDs ¶ added in v0.20.2
ParseProtocolIDs parses the protocol ids field.
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) UnmarshalJSON ¶ added in v0.29.0
UnmarshalJSON unmarshals the Config from JSON.
func (*Config) UnmarshalProtoJSON ¶ added in v0.29.0
func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config message from JSON.
func (*Config) UnmarshalVT ¶
type RegisterFn ¶
RegisterFn is a callback to register apis to a mux.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles incoming streams for a peer id.
func NewServer ¶
func NewServer( b bus.Bus, le *logrus.Entry, info *controller.Info, registerFns []RegisterFn, protocolIDs []protocol.ID, peerIDs []string, disableEstablishLink bool, ) (*Server, error)
NewServer constructs a common srpc controller. If peerIDs and/or domainIDs are empty, matches any.
func (*Server) Close ¶
Close releases any resources used by the controller. Error indicates any issue encountered releasing.
func (*Server) Execute ¶
Execute executes the controller goroutine. Returning nil ends execution. Returning an error triggers a retry with backoff.
func (*Server) GetControllerInfo ¶
func (s *Server) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*Server) HandleDirective ¶
func (s *Server) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive. If it can, it returns a resolver. If not, returns nil.
func (*Server) HandleMountedStream ¶
HandleMountedStream handles an incoming mounted stream. Any returned error indicates the stream should be closed. This function should return as soon as possible, and start additional goroutines to manage the lifecycle of the stream. Typically EstablishLink is asserted in HandleMountedStream.