forward

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidHelo      = Error("invalid HELO")
	ErrInvalidPing      = Error("invalid PING")
	ErrInvalidPong      = Error("invalid PONG")
	ErrInvalidNonce     = Error("invalid nonce")
	ErrInvalidSharedKey = Error("invalid shared key")
	ErrInvalidEntry     = Error("invalid entry")
	ErrFailedConn       = Error("failed connection")
	ErrFailedAuth       = Error("failed authentication")
	ErrNotSupported     = Error("not supported")
)
View Source
const (
	HELO = "HELO"
	PING = "PING"
	PONG = "PONG"
)

Variables

This section is empty.

Functions

func SharedKey

func SharedKey(sharedKey []byte) func(clientHostname string) (sharedKey []byte, err error)

Types

type AsciiFormatter added in v0.9.0

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

func NewAsciiFormatter added in v0.9.0

func NewAsciiFormatter(w io.Writer) *AsciiFormatter

Formats log messages from Fluent Forward protocol into ASCII. Handy for debugging - do not use in production.

func (*AsciiFormatter) Write added in v0.9.0

func (a *AsciiFormatter) Write(p []byte) (n int, err error)

Write implements io.Writer.

type AuthClient

type AuthClient func(ctx context.Context) (Credentials, error)

func StaticAuthClient

func StaticAuthClient(cred Credentials) AuthClient

type AuthServer

type AuthServer func(ctx context.Context, username string) (Credentials, error)

func StaticAuthServer

func StaticAuthServer(cred Credentials) AuthServer

type Client

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

func NewClient

func NewClient(addr string, opt ClientOptions) *Client

func (*Client) Close added in v0.9.1

func (c *Client) Close() (err error)

Close implements io.WriteCloser.

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) (err error)

func (*Client) Reconnect added in v0.9.2

func (c *Client) Reconnect() (err error)

func (*Client) Write

func (c *Client) Write(b []byte) (n int, err error)

func (*Client) WriteBatch

func (c *Client) WriteBatch(tag string, size int, r io.Reader) (err error)

type ClientOptions

type ClientOptions struct {
	Hostname string
	Auth     AuthClient
	TLS      bool
}

type Credentials

type Credentials struct {
	Username  string
	Password  string
	SharedKey string
}

type Error

type Error string

func (Error) Error

func (err Error) Error() string

type Server

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

func NewServer

func NewServer(opt ServerOptions) *Server

func (*Server) Listen

func (s *Server) Listen(ctx context.Context, handler func(ctx context.Context, ss *ServerSession) error) (err error)

type ServerOptions

type ServerOptions struct {
	Address      string
	Hostname     string
	Tls          *tls.Config // E.g. from golang.org/x/crypto/acme/autocert
	HandleError  func(err error)
	Auth         AuthServer
	PasswordAuth bool
	ReadTimeout  time.Duration
}

type ServerSession added in v0.6.0

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

func (*ServerSession) Buffered added in v0.6.0

func (ss *ServerSession) Buffered() int

func (*ServerSession) Close added in v0.6.0

func (ss *ServerSession) Close() error

func (*ServerSession) ID added in v0.6.0

func (ss *ServerSession) ID() uint64

func (*ServerSession) Log added in v0.6.0

func (ss *ServerSession) Log(str string, args ...any)

func (*ServerSession) Next added in v0.6.0

func (ss *ServerSession) Next(e *transport.Entry) (err error)

func (*ServerSession) Rewind added in v0.6.0

func (ss *ServerSession) Rewind()

func (*ServerSession) TimeConnected added in v0.6.0

func (ss *ServerSession) TimeConnected() time.Time

func (*ServerSession) TotalRead added in v0.6.0

func (ss *ServerSession) TotalRead() int

func (*ServerSession) Username added in v0.6.0

func (ss *ServerSession) Username() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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