forward

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PairConnections

func PairConnections(ctx context.Context, username string, incoming, outgoing io.ReadWriteCloser, _, _ string) error

Types

type BWLimit

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

func NewBWLimit

func NewBWLimit(p LimitProvider) *BWLimit

func (*BWLimit) PairConnections

func (l *BWLimit) PairConnections(ctx context.Context, username string, incoming, outgoing io.ReadWriteCloser, network, address string) error

type JSLimitFunc added in v1.40.0

type JSLimitFunc = func(req *jsext.JSRequestInfo, dst *jsext.JSDstInfo, username string) (*LimitParameters, error)

type JSLimitProvider added in v1.40.0

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

func NewJSLimitProvider added in v1.40.0

func NewJSLimitProvider(filename string, instances int, logger *clog.CondLogger) (*JSLimitProvider, error)

func (*JSLimitProvider) Parameters added in v1.40.0

func (j *JSLimitProvider) Parameters(ctx context.Context, username, network, address string) (res *LimitParameters, err error)

type JSLimitSpec added in v1.40.0

type JSLimitSpec struct {
	Filename  string
	Instances int
}

type LimitKind added in v1.40.0

type LimitKind int
const (
	LimitKindNone LimitKind = iota
	LimitKindStatic
	LimitKindJS
)

type LimitParameters added in v1.40.0

type LimitParameters struct {
	UploadBPS     float64 `json:"uploadBPS"`
	UploadBurst   int64   `json:"uploadBurst"`
	DownloadBPS   float64 `json:"downloadBPS"`
	DownloadBurst int64   `json:"downloadBurst"`
	GroupKey      *string `json:"groupKey"`
	Separate      bool    `json:"separate"`
}

type LimitProvider added in v1.40.0

type LimitProvider = func(context.Context, string, string, string) (*LimitParameters, error)

func ProviderFromSpec added in v1.40.0

func ProviderFromSpec(spec LimitSpec, logger *clog.CondLogger) (LimitProvider, error)

type LimitSpec added in v1.40.0

type LimitSpec struct {
	Kind LimitKind
	Spec any
}

type StaticLimitSpec added in v1.40.0

type StaticLimitSpec struct {
	BPS      uint64
	Burst    int64
	Separate bool
}

Jump to

Keyboard shortcuts

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