router

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Block = iota
	Bypass
	Proxy
	Touch
	MaxPolicy
)
View Source
const (
	AsIs         = 0
	IPIfNonMatch = 1
	IPOnDemand   = 2
)
View Source
const MaxPacketSize = 1024 * 8
View Source
const Name = "ROUTER"

Variables

This section is empty.

Functions

func Traffic added in v1.0.3

func Traffic() []byte

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, underlay tunnel.Client) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) DialConn

func (c *Client) DialConn(address *tunnel.Address, user statistic.User, metadata *tunnel.Metadata, overlay tunnel.Tunnel) (tunnel.Conn, error)

func (*Client) DialPacket

func (c *Client) DialPacket(user statistic.User, overlay tunnel.Tunnel) (tunnel.PacketConn, error)

type Config

type Config struct {
	RunType string       `json:"run_type" yaml:"run-type"`
	Router  RouterConfig `json:"router" yaml:"router"`
}

type Conn

type Conn struct {
	tunnel.Conn
	// contains filtered or unexported fields
}

func (*Conn) Epoch

func (c *Conn) Epoch() time.Time

func (*Conn) Name

func (c *Conn) Name() string

func (*Conn) Read

func (c *Conn) Read(p []byte) (int, error)

func (*Conn) Recv

func (c *Conn) Recv() uint64

func (*Conn) Sent

func (c *Conn) Sent() uint64

func (*Conn) Tunnels

func (c *Conn) Tunnels() *tunnel.Tunnels

func (*Conn) Write

func (c *Conn) Write(p []byte) (int, error)

type DynamicConfig

type DynamicConfig struct {
	Router RouterDynamicConfig `json:"router" yaml:"router"`
}

func (*DynamicConfig) Init

func (dconfig *DynamicConfig) Init() error

func (*DynamicConfig) Priority

func (dconfig *DynamicConfig) Priority() int

type PacketConn

type PacketConn struct {
	net.PacketConn

	*Client
	// contains filtered or unexported fields
}

func (*PacketConn) Close

func (c *PacketConn) Close() error

func (*PacketConn) Epoch

func (c *PacketConn) Epoch() time.Time

func (*PacketConn) Name

func (c *PacketConn) Name() string

func (*PacketConn) ReadFrom

func (c *PacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (*PacketConn) ReadWithMetadata

func (c *PacketConn) ReadWithMetadata(p []byte) (int, *tunnel.Metadata, error)

func (*PacketConn) Recv

func (c *PacketConn) Recv() uint64

func (*PacketConn) Sent

func (c *PacketConn) Sent() uint64

func (*PacketConn) Tunnels

func (c *PacketConn) Tunnels() *tunnel.Tunnels

func (*PacketConn) User

func (c *PacketConn) User() statistic.User

func (*PacketConn) WriteTo

func (c *PacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

func (*PacketConn) WriteWithMetadata

func (c *PacketConn) WriteWithMetadata(p []byte, m *tunnel.Metadata) (int, error)

type Router

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

func (*Router) Route

func (r *Router) Route(address *tunnel.Address, metadata *tunnel.Metadata) int

type RouterConfig

type RouterConfig struct {
	Enabled bool `json:"enabled" yaml:"enabled"`
}

type RouterDynamicConfig

type RouterDynamicConfig struct {
	Rules []RouterRule `json:"rules" yaml:"rules"`
	RouterRule

	Router
	// contains filtered or unexported fields
}

type RouterRule

type RouterRule struct {
	Name           string   `json:"name" yaml:"name"`
	Bypass         []string `json:"bypass" yaml:"bypass"`
	Proxy          []string `json:"proxy" yaml:"proxy"`
	Block          []string `json:"block" yaml:"block"`
	Touch          []string `json:"touch" yaml:"touch"`
	DomainStrategy string   `json:"domain_strategy" yaml:"domain-strategy"`
	DefaultPolicy  string   `json:"default_policy" yaml:"default-policy"`
}

type Tunnel

type Tunnel struct{}

func (*Tunnel) Name

func (t *Tunnel) Name() string

func (*Tunnel) NewClient

func (t *Tunnel) NewClient(ctx context.Context, client tunnel.Client) (tunnel.Client, error)

func (*Tunnel) NewServer

func (t *Tunnel) NewServer(ctx context.Context, server tunnel.Server) (tunnel.Server, error)

Jump to

Keyboard shortcuts

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