Documentation ¶
Index ¶
- type ListenerType
- type MultiplexedListener
- func (m *MultiplexedListener) Close()
- func (m *MultiplexedListener) RegisterDefaultListener(p *ProtoListener) error
- func (m *MultiplexedListener) RegisterListener(ltype ListenerType) (*ProtoListener, error)
- func (m *MultiplexedListener) RegisterService(spec *common.Service, ltype ListenerType) error
- func (m *MultiplexedListener) Serve(ctx context.Context) error
- func (m *MultiplexedListener) UnregisterDefaultListener() error
- func (m *MultiplexedListener) UnregisterListener(ltype ListenerType) error
- func (m *MultiplexedListener) UnregisterService(spec *common.Service) error
- type ProtoListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListenerType ¶
type ListenerType int
ListenerType are the types of listeners that can be used.
const ( TCPApplication ListenerType = iota TCPNetwork HTTPApplication HTTPNetwork HTTPSApplication HTTPSNetwork )
Values of ListenerType
type MultiplexedListener ¶
MultiplexedListener is the root listener that will split connections to different protocols.
func NewMultiplexedListener ¶
func NewMultiplexedListener(l net.Listener, mark int) *MultiplexedListener
NewMultiplexedListener returns a new multiplexed listener. Caller must register protocols outside of the new object creation.
func (*MultiplexedListener) Close ¶
func (m *MultiplexedListener) Close()
Close terminates the server without the context.
func (*MultiplexedListener) RegisterDefaultListener ¶
func (m *MultiplexedListener) RegisterDefaultListener(p *ProtoListener) error
RegisterDefaultListener registers a default listener.
func (*MultiplexedListener) RegisterListener ¶
func (m *MultiplexedListener) RegisterListener(ltype ListenerType) (*ProtoListener, error)
RegisterListener registers a new listener. It returns the listener that the various protocol servers should use. If defaultListener is set, this will become the default listener if no match is found. Obviously, there cannot be more than one default.
func (*MultiplexedListener) RegisterService ¶
func (m *MultiplexedListener) RegisterService(spec *common.Service, ltype ListenerType) error
RegisterService associates a service (ip, port) with a listener.
func (*MultiplexedListener) Serve ¶
func (m *MultiplexedListener) Serve(ctx context.Context) error
Serve will demux the connections
func (*MultiplexedListener) UnregisterDefaultListener ¶
func (m *MultiplexedListener) UnregisterDefaultListener() error
UnregisterDefaultListener unregisters the default listener.
func (*MultiplexedListener) UnregisterListener ¶
func (m *MultiplexedListener) UnregisterListener(ltype ListenerType) error
UnregisterListener unregisters a listener. It returns an error if there are services associated with this listener.
func (*MultiplexedListener) UnregisterService ¶
func (m *MultiplexedListener) UnregisterService(spec *common.Service) error
UnregisterService unregisters a service. Returns error if the service doesn't exist.
type ProtoListener ¶
ProtoListener is
func NewProtoListener ¶
func NewProtoListener(mark int) *ProtoListener
NewProtoListener creates a listener for a particular protocol.