transport

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 (
	AsIs         = 0
	IPIfNonMatch = 1
	IPOnDemand   = 2
)
View Source
const Name = "TRANSPORT"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements tunnel.Client

func NewClient

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

NewClient creates a transport layer client

func (*Client) Close

func (c *Client) Close() error

func (*Client) DialConn

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

DialConn implements tunnel.Client. It will ignore the params and directly dial to the remote server

func (*Client) DialPacket

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

type Config

type Config struct {
	LocalHost       string                `json:"local_addr" yaml:"local-addr"`
	LocalPort       int                   `json:"local_port" yaml:"local-port"`
	RemoteHost      string                `json:"remote_addr" yaml:"remote-addr"`
	RemotePort      int                   `json:"remote_port" yaml:"remote-port"`
	TransportPlugin TransportPluginConfig `json:"transport_plugin" yaml:"transport-plugin"`
}

type Conn

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

func (*Conn) Epoch

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

func (*Conn) Metadata

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

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) User

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

func (*Conn) Write

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

type DynamicConfig

type DynamicConfig struct {
	Source SourceConfig `json: "source"`
}

func (*DynamicConfig) Init

func (dconfig *DynamicConfig) Init() (err error)

func (*DynamicConfig) Priority

func (dconfig *DynamicConfig) Priority() int

type Server

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

Server is a server of transport layer

func NewServer

func NewServer(ctx context.Context, _ tunnel.Server) (*Server, error)

NewServer creates a transport layer server

func (*Server) AcceptConn

func (s *Server) AcceptConn(overlay tunnel.Tunnel) (tunnel.Conn, error)

func (*Server) AcceptPacket

func (s *Server) AcceptPacket(tunnel.Tunnel) (tunnel.PacketConn, error)

func (*Server) Close

func (s *Server) Close() error

type Source

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

type SourceConfig

type SourceConfig struct {
	Rules []SourceRule `json:"rules" yaml:"rules"`
	SourceRule

	Source
	// contains filtered or unexported fields
}

type SourceRule

type SourceRule struct {
	Name           string             `json:"name" yaml:"name"`
	SourceHost     string             `json:"source_addr" yaml:"source-addr"`
	SourcePort     int                `json:"source_port" yaml:"source-port"`
	SourceRule     []SourceRuleConfig `json:"source_rule" yaml:"source-rule"`
	DomainStrategy string             `json:"domain_strategy" yaml:"domain-strategy"`
}

type SourceRuleConfig

type SourceRuleConfig struct {
	SourceHost string   `json:"source_addr" yaml:"source-addr"`
	SourcePort int      `json:"source_port" yaml:"source-port"`
	Match      []string `json:"match" yaml:"match"`
}

type SourceRules

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

func (*SourceRules) Route

func (sourceRules *SourceRules) Route(address *tunnel.Address) int

type TransportPluginConfig

type TransportPluginConfig struct {
	Enabled bool     `json:"enabled" yaml:"enabled"`
	Type    string   `json:"type" yaml:"type"`
	Command string   `json:"command" yaml:"command"`
	Option  string   `json:"option" yaml:"option"`
	Arg     []string `json:"arg" yaml:"arg"`
	Env     []string `json:"env" yaml:"env"`
}

type Tunnel

type Tunnel struct{}

func (*Tunnel) Name

func (*Tunnel) Name() string

func (*Tunnel) NewClient

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

func (*Tunnel) NewServer

func (*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