netpunchlib

package
v0.0.0-...-3d138bb Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client(ctx context.Context, slot, address, remoteAddress string, opt ...Option) (*net.UDPAddr, *net.UDPAddr, error)

func Server

func Server(ctx context.Context, address string, options ...Option) error

Types

type Config

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

type Connection

type Connection interface {
	ConnectionReader
	ConnectionWriter
	ConnectionCloser
}

type ConnectionCloser

type ConnectionCloser interface {
	Close() error
}

type ConnectionMiddleware

type ConnectionMiddleware func(Connection) Connection

func LoggingMiddleware

func LoggingMiddleware(log logInterface) ConnectionMiddleware

func SigningMiddleware

func SigningMiddleware(secret []byte) ConnectionMiddleware

type ConnectionReader

type ConnectionReader interface {
	ReadFromUDP([]byte) (int, *net.UDPAddr, error)
}

type ConnectionWriter

type ConnectionWriter interface {
	WriteToUDP([]byte, *net.UDPAddr) (int, error)
}

type Option

type Option func(cfg *Config)

func ConnOption

func ConnOption(mw ...ConnectionMiddleware) Option

Directories

Path Synopsis
internal
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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