s2s

package
v0.62.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(outProvider *OutProvider) router.S2SRouter

NewRouter creates and returns an initialized S2S router.

Types

type DialbackParams

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

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

InHub represents an S2S incoming connection hub.

func NewInHub

func NewInHub(logger kitlog.Logger) *InHub

NewInHub creates and initializes a new InHub instance.

func (*InHub) Start

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

Start starts InHub instance.

func (*InHub) Stop

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

Stop stops InHub instance.

type ListenerConfig added in v0.55.0

type ListenerConfig struct {
	// BindAddr defines listener incoming connections address.
	BindAddr string `fig:"bind_addr"`

	// Port defines listener incoming connections port.
	Port int `fig:"port" default:"5269"`

	// ConnectTimeout defines connection timeout.
	ConnectTimeout time.Duration `fig:"conn_timeout" default:"3s"`

	// KeepAliveTimeout defines stream read timeout.
	KeepAliveTimeout time.Duration `fig:"keep_alive_timeout" default:"10m"`

	// RequestTimeout defines S2S stream request timeout.
	RequestTimeout time.Duration `fig:"req_timeout" default:"15s"`

	// MaxStanzaSize is the maximum size a listener incoming stanza may have.
	MaxStanzaSize int `fig:"max_stanza_size" default:"1048576"`

	// DirectTLS, if true, tls.Listen will be used as network listener.
	DirectTLS bool `fig:"direct_tls"`
}

ListenerConfig defines S2S listener configuration.

type ListenersConfig added in v0.55.0

type ListenersConfig []ListenerConfig

ListenersConfig defines a set of S2S listener configurations.

type OutConfig added in v0.55.0

type OutConfig struct {
	// DialbackSecret defines S2S dialback secret key.
	DialbackSecret string `fig:"dialback_secret"`

	// DialTimeout defines S2S out dialer timeout.
	DialTimeout time.Duration `fig:"dial_timeout" default:"5s"`

	// KeepAliveTimeout defines stream read timeout.
	KeepAliveTimeout time.Duration `fig:"keep_alive_timeout" default:"10m"`

	// RequestTimeout defines S2S stream request timeout.
	RequestTimeout time.Duration `fig:"req_timeout" default:"15s"`

	// MaxStanzaSize is the maximum size a listener incoming stanza may have.
	MaxStanzaSize int `fig:"max_stanza_size" default:"131072"`
}

OutConfig defines S2S out configuration.

type OutProvider

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

OutProvider is an outgoing S2S stream provider.

func NewOutProvider

func NewOutProvider(
	cfg OutConfig,
	hosts *host.Hosts,
	kv kv.KV,
	shapers shaper.Shapers,
	hk *hook.Hooks,
	logger kitlog.Logger,
) *OutProvider

NewOutProvider creates and initializes a new OutProvider instance.

func (*OutProvider) DialbackSecret added in v0.55.0

func (p *OutProvider) DialbackSecret() string

DialbackSecret returns dialback secret value.

func (*OutProvider) GetDialback

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

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

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

Start starts S2S out provider.

func (*OutProvider) Stop

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

Stop stops S2S out provider.

type SocketListener

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

SocketListener represents a S2S socket listener type.

func NewListeners added in v0.55.0

func NewListeners(
	cfg ListenersConfig,
	hosts *host.Hosts,
	router router.Router,
	comps *component.Components,
	mods *module.Modules,
	outProvider *OutProvider,
	inHub *InHub,
	kv kv.KV,
	shapers shaper.Shapers,
	hk *hook.Hooks,
	logger kitlog.Logger,
) []*SocketListener

NewListeners creates and initializes a set of S2S listeners based of cfg configuration.

func (*SocketListener) Start

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

func (l *SocketListener) Stop(ctx 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