s2s

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter added in v0.50.0

func NewRouter(outProvider *OutProvider) router.S2SRouter

NewRouter creates and returns an initialized S2S router.

Types

type DialbackParams added in v0.50.0

type DialbackParams struct {
	// StreamID represents verification stream identifier.
	StreamID string

	// From represents verification sender domain.
	From string

	// To represents verification target domain.
	To string

	// Key is the dialback generated key.
	Key string
}

DialbackParams contains S2S dialback verification parameters.

type InHub added in v0.50.0

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

InHub represents an S2S incoming connection hub.

func NewInHub added in v0.50.0

func NewInHub() *InHub

NewInHub creates and initializes a new InHub instance.

func (*InHub) Start added in v0.50.0

func (h *InHub) Start(_ context.Context) error

Start starts InHub instance.

func (*InHub) Stop added in v0.50.0

func (h *InHub) Stop(ctx context.Context) error

Stop stops InHub instance.

type Options added in v0.50.0

type Options struct {
	DialTimeout time.Duration

	DialbackSecret string

	// ConnectTimeout defines connection timeout.
	ConnectTimeout time.Duration

	// KeepAlive defines stream read timeout.
	KeepAlive time.Duration

	// RequestTimeout defines S2S stream request timeout.
	RequestTimeout time.Duration

	// MaxStanzaSize is the maximum size a listener incoming stanza may have.
	MaxStanzaSize int

	// UseTLS, if true, tls.Listen will be used as network listener.
	UseTLS bool

	// TLSConfig contains configuration to be used when TLS listener is enabled.
	TLSConfig *tls.Config
}

Options defines S2S connection options.

type OutProvider added in v0.10.1

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

OutProvider is an outgoing S2S stream provider.

func NewOutProvider added in v0.10.1

func NewOutProvider(
	hosts *host.Hosts,
	kv kv.KV,
	shapers shaper.Shapers,
	sn *sonar.Sonar,
	opts Options,
) *OutProvider

NewOutProvider creates and initializes a new OutProvider instance.

func (*OutProvider) GetDialback added in v0.50.0

func (p *OutProvider) GetDialback(ctx context.Context, sender, target string, params DialbackParams) (stream.S2SDialback, error)

GetDialback returns associated dialback S2S stream given a sender-target pair domain and a parameters set.

func (*OutProvider) GetOut added in v0.10.1

func (p *OutProvider) GetOut(ctx context.Context, sender, target string) (stream.S2SOut, error)

GetOut returns associated outgoing S2S stream given a sender-target pair domain.

func (*OutProvider) Start added in v0.50.0

func (p *OutProvider) Start(_ context.Context) error

Start starts S2S out provider.

func (*OutProvider) Stop added in v0.50.0

func (p *OutProvider) Stop(ctx context.Context) error

Stop stops S2S out provider.

type SocketListener added in v0.50.0

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

SocketListener represents a S2S socket listener type.

func NewSocketListener added in v0.50.0

func NewSocketListener(
	bindAddr string,
	port int,
	hosts *host.Hosts,
	router router.Router,
	comps *component.Components,
	mods *module.Modules,
	outProvider *OutProvider,
	inHub *InHub,
	kv kv.KV,
	shapers shaper.Shapers,
	sonar *sonar.Sonar,
	opts Options,
) *SocketListener

NewSocketListener returns a new S2S socket listener.

func (*SocketListener) Start added in v0.50.0

func (l *SocketListener) Start(ctx context.Context) error

Start starts listening on the TCP network address bindAddr to handle incoming S2S connections.

func (*SocketListener) Stop added in v0.50.0

func (l *SocketListener) Stop(_ context.Context) error

Stop stops handling incoming S2S connections and closes underlying TCP listener.

Jump to

Keyboard shortcuts

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