prober

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientClosed = errors.New("The client is already closed")
View Source
var (
	ErrNoTLS = errors.New("TLS not negotiated")
)
View Source
var ErrNotThisNetwork = errors.New("address family disabled by config and configured address family not offered")

Functions

func CheckDialbackOffered

func CheckDialbackOffered(offered *bool) xmpp.StreamFeature

func CheckSASLOffered

func CheckSASLOffered(offered *bool, mechanisms *[]string) xmpp.StreamFeature

func NewTLSConfig added in v0.6.0

func NewTLSConfig(cfg *pconfig.TLSConfig, domain string) (*tls.Config, error)

func ProbeC2S

func ProbeC2S(ctx context.Context, module, target string, config config.Module, _ Clients, registry *prometheus.Registry) bool

func ProbeIBR

func ProbeIBR(ctx context.Context, module, target string, config config.Module, _ Clients, registry *prometheus.Registry) bool

func ProbePing

func ProbePing(ctx context.Context, module, target string, cfg config.Module, clients Clients, registry *prometheus.Registry) bool

func ProbeS2S

func ProbeS2S(ctx context.Context, module, target string, config config.Module, _ Clients, registry *prometheus.Registry) bool

func Register

func Register(prefix string, server string, account *jid.JID, password *string) xmpp.StreamFeature

func ValidateSASLMechanisms

func ValidateSASLMechanisms(mechanisms []string, forbidden []string, required []string) bool

Types

type AccountInfo

type AccountInfo struct {
	Registered bool
	Account    jid.JID
	Password   string
}

type Client added in v0.6.0

type Client struct {
	Config             *ClientConfig
	HealthCheckTimeout time.Duration
	// contains filtered or unexported fields
}

func NewClient added in v0.6.0

func NewClient(Config *ClientConfig) *Client

func (*Client) AcquireSession added in v0.6.0

func (c *Client) AcquireSession(ctx context.Context) (*xmpp.Session, error)

Return the current session or establish a new session if there is no current session.

If session establishment fails, it is not retried, but an error is returned. The next call to AcquireSession will retry.

func (*Client) Close added in v0.6.0

func (c *Client) Close()

func (*Client) Healthcheck added in v0.6.0

func (c *Client) Healthcheck()

Schedule a healthcheck if there isn’t currently one running

If the healthcheck fails, the connection will be closed and a new session will be established for the next use.

type ClientConfig added in v0.6.0

type ClientConfig struct {
	TLS           *tls.Config
	ClientAddress jid.JID
	Password      string
	DirectTLS     bool
}

func (*ClientConfig) Login added in v0.6.0

func (cfg *ClientConfig) Login(ctx context.Context) (ct connTrace, conn net.Conn, session *xmpp.Session, err error)

type ClientFactory added in v0.6.0

type ClientFactory interface {
	Login(ctx context.Context) (ct connTrace, conn net.Conn, session *xmpp.Session, err error)
}

type Clients added in v0.6.0

type Clients map[string]*Client

type ProbeFn

type ProbeFn func(ctx context.Context, module, target string, config config.Module, clients Clients, registry *prometheus.Registry) bool

type RegisterQuery

type RegisterQuery struct {
	XMLName      xml.Name `xml:"jabber:iq:register query"`
	Instructions string   `xml:"jabber:iq:register instructions"`
	Username     string   `xml:"jabber:iq:register username"`
	Password     string   `xml:"jabber:iq:register password"`
	Email        string   `xml:"jabber:iq:register email"`
}

func (*RegisterQuery) TokenReader

func (r *RegisterQuery) TokenReader() xml.TokenReader

type StartTLSCapture

type StartTLSCapture struct {
	CapturedWriter io.ReadWriter
	// contains filtered or unexported fields
}

func NewCapturingStartTLS

func NewCapturingStartTLS(cfg *tls.Config) *StartTLSCapture

func (*StartTLSCapture) ToStreamFeature

func (c *StartTLSCapture) ToStreamFeature() xmpp.StreamFeature

type StartTLSConfigurableDialer added in v0.6.0

type StartTLSConfigurableDialer struct {
	net.Dialer
	DirectTLS bool
	TLSConfig *tls.Config
}

func (*StartTLSConfigurableDialer) Dial added in v0.6.0

func (d *StartTLSConfigurableDialer) Dial(ctx context.Context, network, address string) (net.Conn, error)

type StreamInfo

type StreamInfo struct {
	Negotiated      bool
	SASLOffered     bool
	SASLMechanisms  []string
	DialbackOffered bool
}

type XMPPDialer added in v0.6.0

type XMPPDialer struct {
	StartTLSConfigurableDialer
	S2S bool
}

func (*XMPPDialer) Dial added in v0.6.0

func (d *XMPPDialer) Dial(ctx context.Context, network string, addr jid.JID) (net.Conn, error)

Jump to

Keyboard shortcuts

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