freedom

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: 17 Imported by: 0

Documentation

Index

Constants

View Source
const MaxPacketSize = 1024 * 8
View Source
const Name = "FREEDOM"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

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

func (*Client) Close

func (c *Client) Close() error

func (*Client) DialConn

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

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"`
	TCP                 TCPConfig          `json:"tcp" yaml:"tcp"`
	ForwardProxy        ForwardProxyConfig `json:"forward_proxy" yaml:"forward-proxy"`
	Interface           string             `json:"interface" yaml:"interface"`
	EnableInterfaceBind bool               `json:"enable_interface_bind" yaml:"enable-interface-bind"`
	NameServer          []string           `json:"nameserver" yaml:"nameserver"`
}

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 ForwardProxyConfig

type ForwardProxyConfig struct {
	Enabled   bool   `json:"enabled" yaml:"enabled"`
	ProxyHost string `json:"proxy_addr" yaml:"proxy-addr"`
	ProxyPort int    `json:"proxy_port" yaml:"proxy-port"`
	Username  string `json:"username" yaml:"username"`
	Password  string `json:"password" yaml:"password"`
}

type PacketConn

type PacketConn struct {
	*net.UDPConn
	// contains filtered or unexported fields
}

func (*PacketConn) Epoch

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

func (*PacketConn) Name

func (c *PacketConn) Name() string

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) (int, error)

func (*PacketConn) WriteWithMetadata

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

type SocksPacketConn

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

func (*SocksPacketConn) Close

func (c *SocksPacketConn) Close() error

func (*SocksPacketConn) Epoch

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

func (*SocksPacketConn) Name

func (c *SocksPacketConn) Name() string

func (*SocksPacketConn) ReadWithMetadata

func (c *SocksPacketConn) ReadWithMetadata(payload []byte) (int, *tunnel.Metadata, error)

func (*SocksPacketConn) Recv

func (c *SocksPacketConn) Recv() uint64

func (*SocksPacketConn) Sent

func (c *SocksPacketConn) Sent() uint64

func (*SocksPacketConn) Tunnels

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

func (*SocksPacketConn) User

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

func (*SocksPacketConn) WriteWithMetadata

func (c *SocksPacketConn) WriteWithMetadata(payload []byte, metadata *tunnel.Metadata) (int, error)

type TCPConfig

type TCPConfig struct {
	PreferIPV4 bool   `json:"prefer_ipv4" yaml:"prefer-ipv4"`
	KeepAlive  bool   `json:"keep_alive" yaml:"keep-alive"`
	NoDelay    bool   `json:"no_delay" yaml:"no-delay"`
	Timeout    string `json:"timeout" yaml:"timeout"`
}

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, client tunnel.Server) (tunnel.Server, error)

Jump to

Keyboard shortcuts

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