dns

package
v1.0.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FakeIP = 0
	Bypass = 1
	Proxy  = 2
)
View Source
const MaxPacketSize = 1024 * 8
View Source
const Name = "DNS"

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

func (*Client) LookBackAddress

func (c *Client) LookBackAddress(address *tunnel.Address) *tunnel.Address

func (*Client) Route

func (client *Client) Route(domain string) int

type Config

type Config struct {
	RunType string    `json:"run_type" yaml:"run-type"`
	Dns     DnsConfig `json:"dns" yaml:"dns"`
}

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 DnsConfig

type DnsConfig struct {
	Enabled       bool     `json:"enabled" yaml:"enabled"`
	Bypass        []string `json:"bypass" yaml:"bypass"`
	Proxy         []string `json:"proxy" yaml:"proxy"`
	FakeIP        []string `json:"fakeip" yaml:"fakeip"`
	FakeIPRange   string   `json:"fakeip_range" yaml:"fakeip-range"`
	DefaultPolicy string   `json:"default_policy" yaml:"default-policy"`
}

type FakePacketConn

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

func (*FakePacketConn) Close

func (c *FakePacketConn) Close() error

func (*FakePacketConn) ReadFrom

func (c *FakePacketConn) ReadFrom(p []byte) (int, net.Addr, error)

func (*FakePacketConn) WriteTo

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

type PacketConn

type PacketConn struct {
	tunnel.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 Pool added in v1.0.3

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

func NewPool added in v1.0.3

func NewPool(size int) *Pool

New return Pool instance

func (*Pool) LookBack added in v1.0.3

func (p *Pool) LookBack(ip net.IP) (string, bool)

func (*Pool) Lookup added in v1.0.3

func (p *Pool) Lookup(host string) net.IP

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