util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COMMAND_DATA        = 0x01
	COMMAND_CLOSE_WRITE = 0x02

	PACK_DATA_BUF_SIZE = 4
)
View Source
const MagicKeySalt = "tox"

Variables

View Source
var (
	Name        = "@isayme/tox"
	Version     = "unknown"
	BuildTime   = "unknown"
	GitRevision = "unknown"
)

version info

Functions

func CopyBuffer added in v0.2.1

func CopyBuffer(dst io.Writer, src io.Reader) (written int64, err error)

Copy copy with default buf

func EnableProfiling

func EnableProfiling(enabled bool)

func FormatURL

func FormatURL(s string) (string, error)

func GenerateJwtToken

func GenerateJwtToken(key []byte) (string, error)

func HashedPassword added in v0.2.0

func HashedPassword(password string) string

func KDF

func KDF(password string, salt []byte, keySize int) []byte

func NewTimeoutConn

func NewTimeoutConn(conn net.Conn, timeout time.Duration) *timeoutConn

NewTimeoutConn create timeout conn

func NextNonce

func NextNonce(nonce []byte)

func NowInMills

func NowInMills() int64

func PrintVersion

func PrintVersion()

PrintVersion print version

func Stringify

func Stringify(v interface{}) string

func ValidateJwtToken

func ValidateJwtToken(tokenString string, key []byte) error

Types

type Frame added in v1.1.0

type Frame struct {
	Cmd  uint8
	Data []byte
}

type ToxConn added in v1.0.0

type ToxConn interface {
	io.Reader
	io.Writer
	io.Closer
	CloseWrite() error
}

func NewToxConnection added in v1.0.0

func NewToxConnection(conn io.ReadWriteCloser) ToxConn

type ToxConnection added in v1.0.0

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

func (*ToxConnection) Close added in v1.0.0

func (conn *ToxConnection) Close() error

func (*ToxConnection) CloseWrite added in v1.0.0

func (conn *ToxConnection) CloseWrite() error

func (*ToxConnection) Read added in v1.0.0

func (conn *ToxConnection) Read(p []byte) (int, error)

func (*ToxConnection) Write added in v1.0.0

func (conn *ToxConnection) Write(p []byte) (int, error)

type ToxOption added in v1.0.0

type ToxOption interface {
	// contains filtered or unexported methods
}

func WithCertFile added in v1.0.0

func WithCertFile(certFile string) ToxOption

func WithConnectTimeout added in v1.0.0

func WithConnectTimeout(timeout time.Duration) ToxOption

func WithInsecureSkipVerify added in v1.0.0

func WithInsecureSkipVerify(insecureSkipVerify bool) ToxOption

func WithKeyFile added in v1.0.0

func WithKeyFile(keyFile string) ToxOption

func WithLocalAddress added in v1.0.0

func WithLocalAddress(localAddress string) ToxOption

func WithPassword added in v1.0.0

func WithPassword(password string) ToxOption

func WithTimeout added in v1.0.0

func WithTimeout(timeout time.Duration) ToxOption

func WithTunnel added in v1.0.0

func WithTunnel(tunnel string) ToxOption

type ToxOptions added in v1.0.0

type ToxOptions struct {
	Password           string
	Tunnel             string
	LocalAddress       string
	CertFile           string
	KeyFile            string
	ConnectTimeout     time.Duration
	Timeout            time.Duration
	InsecureSkipVerify bool
}

func ToToxOptions added in v1.0.0

func ToToxOptions(opts []ToxOption) ToxOptions

Jump to

Keyboard shortcuts

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