fastforward

package
v5.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const PluginType = "forward"

Variables

This section is empty.

Functions

func Init

func Init(bp *coremain.BP, args any) (any, error)

Types

type Args

type Args struct {
	Upstreams  []UpstreamConfig `yaml:"upstreams"`
	Concurrent int              `yaml:"concurrent"`

	// Global options.
	Socks5       string `yaml:"socks5"`
	SoMark       int    `yaml:"so_mark"`
	BindToDevice string `yaml:"bind_to_device"`
	Bootstrap    string `yaml:"bootstrap"`
	BootstrapVer int    `yaml:"bootstrap_version"`
}

type Forward

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

func NewForward

func NewForward(args *Args, opt Opts) (*Forward, error)

NewForward inits a Forward from given args. args must contain at least one upstream.

func (*Forward) Close

func (f *Forward) Close() error

func (*Forward) Exec

func (f *Forward) Exec(ctx context.Context, qCtx *query_context.Context) (err error)

func (*Forward) QuickConfigureExec

func (f *Forward) QuickConfigureExec(args string) (any, error)

QuickConfigureExec format: [upstream_tag]...

func (*Forward) RegisterMetricsTo

func (f *Forward) RegisterMetricsTo(r prometheus.Registerer) error

type Opts

type Opts struct {
	Logger     *zap.Logger
	MetricsTag string
}

type UpstreamConfig

type UpstreamConfig struct {
	Tag         string `yaml:"tag"`
	Addr        string `yaml:"addr"` // Required.
	DialAddr    string `yaml:"dial_addr"`
	IdleTimeout int    `yaml:"idle_timeout"`

	// Deprecated: This option has no affect.
	// TODO: (v6) Remove this option.
	MaxConns           int  `yaml:"max_conns"`
	EnablePipeline     bool `yaml:"enable_pipeline"`
	EnableHTTP3        bool `yaml:"enable_http3"`
	InsecureSkipVerify bool `yaml:"insecure_skip_verify"`

	Socks5       string `yaml:"socks5"`
	SoMark       int    `yaml:"so_mark"`
	BindToDevice string `yaml:"bind_to_device"`
	Bootstrap    string `yaml:"bootstrap"`
	BootstrapVer int    `yaml:"bootstrap_version"`
}

Jump to

Keyboard shortcuts

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