Documentation
¶
Index ¶
- func NewRouter(outProvider *OutProvider) router.S2SRouter
- type DialbackParams
- type InHub
- type ListenerConfig
- type ListenersConfig
- type OutConfig
- type OutProvider
- func (p *OutProvider) DialbackSecret() string
- func (p *OutProvider) GetDialback(ctx context.Context, sender, target string, params DialbackParams) (stream.S2SDialback, error)
- func (p *OutProvider) GetOut(ctx context.Context, sender, target string) (stream.S2SOut, error)
- func (p *OutProvider) Start(_ context.Context) error
- func (p *OutProvider) Stop(ctx context.Context) error
- type SocketListener
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.
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 ¶
GetOut returns associated outgoing S2S stream given a sender-target pair domain.
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.