listener

package
v0.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DiscoveryClientPingInterval = time.Minute

The probing interval for publisher to check the publish status. This is required in case discovery server does not send close signal.

View Source
var ErrNoListenerConfigured = fmt.Errorf("url must contain port= or relay=1 field")

Functions

func CreateDirectListener

func CreateDirectListener(Context context.Context, URL *url.URL, config *ListenerConfig) (net.Listener, []url.URL, error)

RegisterURLListener creates a listener on the given URL. This URL can only be TCP or UDP for direct access cases. Append query `enc=1` for e2e encryption (Only works on TCP).

Types

type ListenerConfig

type ListenerConfig struct {
	IdleUDPTimeout time.Duration
	XConfig        *xconn.Config

	// This will cause receiver returns merged packets.
	GSOGROOptimization bool
}

type MultiListener

type MultiListener struct {
	// contains filtered or unexported fields
}

MultiListener is a listener wrapper mainly used to combine with discovery server.

A normal process is like:

lis := listener.New()
defer lis.Close()
lis.RegisterListener(innerListener, urls)
lis.Initialize()
lis.PublishToDiscoveryServer(conn, channel)
...
conn, err := lis.Accept()

func New

func New(Context context.Context) *MultiListener

New creates a listener with `Context`

func (*MultiListener) Accept

func (l *MultiListener) Accept() (net.Conn, error)

func (*MultiListener) Addr

func (l *MultiListener) Addr() net.Addr

func (*MultiListener) AllURLs

func (l *MultiListener) AllURLs() []url.URL

func (*MultiListener) Close

func (l *MultiListener) Close() error

func (*MultiListener) Initialize

func (l *MultiListener) Initialize() error

func (*MultiListener) PublishToDiscoveryServer

func (l *MultiListener) PublishToDiscoveryServer(DiscoveryServerConn net.Conn, Channel string) error

func (*MultiListener) RegisterListener

func (l *MultiListener) RegisterListener(InnerListener net.Listener, URL []url.URL) error

RegisterListener registers a listener into multi listener with given list of URLs. The multi listener will close this listener once completed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL