forward

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 22 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 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) Connect

func (c *Client) Connect(ctx context.Context) (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
}

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(c *ServerConn) error) (err error)

type ServerConn

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

func (*ServerConn) Entries added in v0.4.0

func (s *ServerConn) Entries() iter.Seq2[time.Time, *msgpack.Iterator]

func (*ServerConn) String

func (s *ServerConn) String() string

func (*ServerConn) Tag added in v0.4.0

func (s *ServerConn) Tag() string

func (*ServerConn) TotalRead added in v0.4.0

func (s *ServerConn) TotalRead() int

func (*ServerConn) Username added in v0.4.0

func (s *ServerConn) Username() string

type ServerOptions

type ServerOptions struct {
	Address      string
	Hostname     string
	Tls          *tls.Config // E.g. from golang.org/x/crypto/acme/autocert
	Auth         AuthServer
	PasswordAuth bool
}

Jump to

Keyboard shortcuts

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