Documentation ¶
Index ¶
- Variables
- func Dial(network string, address string) (net.Conn, error)
- func Gravity(conn io.ReadWriteCloser, k []byte) io.ReadWriteCloser
- func GravityReader(r io.Reader, k []byte) io.Reader
- func GravityWriter(w io.Writer, k []byte) io.Writer
- func Hang()
- func Link(a, b io.ReadWriteCloser)
- func LoadApnic() map[string][]*net.IPNet
- func LoadReservedIP() []*net.IPNet
- func OpenFile(name string) (io.ReadCloser, error)
- func Reno(network string, address string) (net.Conn, error)
- func ResolverDns(addr string) *net.Resolver
- func ResolverDoh(addr string) *net.Resolver
- func ResolverDot(addr string) *net.Resolver
- func Salt(s string) []byte
- type Aimbot
- type AimbotOption
- type Cdoh
- func (c Cdoh) Close() error
- func (c Cdoh) LocalAddr() net.Addr
- func (c Cdoh) Read(b []byte) (n int, err error)
- func (c Cdoh) RemoteAddr() net.Addr
- func (c Cdoh) SetDeadline(t time.Time) error
- func (c Cdoh) SetReadDeadline(t time.Time) error
- func (c Cdoh) SetWriteDeadline(t time.Time) error
- func (c Cdoh) Write(b []byte) (n int, err error)
- type Context
- type Dialer
- type Direct
- type Locale
- func (l *Locale) Close() error
- func (l *Locale) Run() error
- func (l *Locale) Serve(ctx *Context, app io.ReadWriteCloser) error
- func (l *Locale) ServeProxy(ctx *Context, app io.ReadWriteCloser) error
- func (l *Locale) ServeSocks4(ctx *Context, app io.ReadWriteCloser) error
- func (l *Locale) ServeSocks5(ctx *Context, app io.ReadWriteCloser) error
- func (l *Locale) ServeSocks5TCP(ctx *Context, app io.ReadWriteCloser, dst string) error
- func (l *Locale) ServeSocks5UDP(ctx *Context, app io.ReadWriteCloser) error
- type ReadWriteCloser
- type Road
- type Router
- type RouterCache
- type RouterChain
- type RouterIPNet
- type RouterRight
- type RouterRules
- type Tester
Constants ¶
This section is empty.
Variables ¶
var Conf = struct { DialerTimeout time.Duration RouterLruSize int }{ DialerTimeout: time.Second * 8, RouterLruSize: 64, }
Conf is acting as package level configuration.
Functions ¶
func Gravity ¶
func Gravity(conn io.ReadWriteCloser, k []byte) io.ReadWriteCloser
Gravity double, happiness double.
func GravityReader ¶
GravityReader wraps an io.Reader with RC4 crypto.
func GravityWriter ¶
GravityWriter wraps an io.Writer with RC4 crypto.
func Link ¶
func Link(a, b io.ReadWriteCloser)
Link copies from src to dst and dst to src until either EOF is reached.
func LoadApnic ¶
LoadApnic loads remote resource. APNIC is the Regional Internet Registry administering IP addresses for the Asia Pacific.
func LoadReservedIP ¶ added in v1.18.2
LoadReservedIP loads reserved ip addresses.
Introduction: See https://en.wikipedia.org/wiki/Reserved_IP_addresses
func OpenFile ¶
func OpenFile(name string) (io.ReadCloser, error)
OpenFile select the appropriate method to open the file based on the incoming args automatically.
Examples: OpenFile("/etc/hosts") OpenFile("https://raw.githubusercontent.com/mohanson/daze/master/README.md")
func ResolverDns ¶ added in v1.19.2
ResolverDns returns a DNS resolver.
func ResolverDoh ¶ added in v1.19.4
ResolverDoh returns a DoH resolver. For further information, see https://datatracker.ietf.org/doc/html/rfc8484.
func ResolverDot ¶ added in v1.19.2
ResolverDot returns a DoT resolver. For further information, see https://datatracker.ietf.org/doc/html/rfc7858.
Types ¶
type Aimbot ¶
Aimbot automatically distinguish whether to use a proxy or a local network.
func NewAimbot ¶ added in v1.18.0
func NewAimbot(client Dialer, option *AimbotOption) *Aimbot
NewAimbot returns a new Aimbot.
type AimbotOption ¶ added in v1.18.0
AimbotOption provides configuration for quick initialization of Aimbot.
type Cdoh ¶ added in v1.19.4
Cdoh structure can be used for DoH protocol processing.
func (Cdoh) RemoteAddr ¶ added in v1.19.4
type Dialer ¶
type Dialer interface {
Dial(ctx *Context, network string, address string) (io.ReadWriteCloser, error)
}
Dialer abstracts the way to establish network connections.
type Locale ¶
Locale is the main process of daze. In most cases, it is usually deployed as a daemon on a local machine.
func (*Locale) Serve ¶
func (l *Locale) Serve(ctx *Context, app io.ReadWriteCloser) error
Serve serves incoming connections and handle it with a different handler(ServeProxy/ServeSocks4/ServeSocks5).
func (*Locale) ServeProxy ¶
func (l *Locale) ServeProxy(ctx *Context, app io.ReadWriteCloser) error
ServeProxy serves traffic in HTTP Proxy/Tunnel format.
Introduction: See https://en.wikipedia.org/wiki/Proxy_server See https://en.wikipedia.org/wiki/HTTP_tunnel See https://www.infoq.com/articles/Web-Sockets-Proxy-Servers/
func (*Locale) ServeSocks4 ¶
func (l *Locale) ServeSocks4(ctx *Context, app io.ReadWriteCloser) error
ServeSocks4 serves traffic in SOCKS4/SOCKS4a format.
Introduction: See https://en.wikipedia.org/wiki/SOCKS See http://ftp.icm.edu.pl/packages/socks/socks4/SOCKS4.protocol
func (*Locale) ServeSocks5 ¶
func (l *Locale) ServeSocks5(ctx *Context, app io.ReadWriteCloser) error
ServeSocks5 serves traffic in SOCKS5 format.
Introduction: See https://en.wikipedia.org/wiki/SOCKS See https://tools.ietf.org/html/rfc1928
func (*Locale) ServeSocks5TCP ¶
ServeSocks5TCP serves socks5 TCP protocol.
func (*Locale) ServeSocks5UDP ¶
func (l *Locale) ServeSocks5UDP(ctx *Context, app io.ReadWriteCloser) error
ServeSocks5UDP serves socks5 UDP protocol.
type ReadWriteCloser ¶
ReadWriteCloser is the interface that groups the basic Read, Write and Close methods.
type Router ¶
type Router interface { // The host must be a literal IP address, or a host name that can be resolved to IP addresses. // Examples: // Road("golang.org") // Road("192.0.2.1") Road(ctx *Context, host string) Road }
Router is a selector that will judge the host address.
type RouterCache ¶
RouterCache cache routing results for next use.
func NewRouterCache ¶
func NewRouterCache(r Router) *RouterCache
NewRouterCache returns a new Cache object.
type RouterChain ¶ added in v1.17.1
type RouterChain struct {
L []Router
}
RouterChain concat multiple routers in series.
func NewRouterChain ¶ added in v1.17.1
func NewRouterChain(router ...Router) *RouterChain
NewRouterChain returns a new RouterChain.
type RouterIPNet ¶
RouterIPNet is a router by IPNets. It judges whether an IP or domain name is within its range.
func NewRouterIPNet ¶
func NewRouterIPNet() *RouterIPNet
NewRouterIPNet returns a new RouterIPNet object.
func (*RouterIPNet) FromFile ¶ added in v1.18.2
func (r *RouterIPNet) FromFile(name string)
FromFile loads a CIDR file.
type RouterRight ¶
type RouterRight struct {
R Road
}
RouterRight always returns the same road.
func NewRouterRight ¶
func NewRouterRight(road Road) *RouterRight
NewRouterRight returns a new RouterRight.
type RouterRules ¶
RouterRules aims to be a minimal configuration file format that's easy to read due to obvious semantics. There are two parts per line on the RULE file: mode and glob. mode is on the left of the space sign and glob is on the right. mode is a character that describes whether the host should be accessed through a proxy, and the glob is a glob-style string.
Glob patterns: * h?llo matches hello, hallo and hxllo * h*llo matches hllo and heeeello * h[ae]llo matches hello and hallo, but not hillo * h[^e]llo matches hallo, hbllo, ... but not hello * h[a-b]llo matches hallo and hbllo
This is a normal RULE document: L a.com a.a.com R b.com *.b.com B c.com
L(ocale) means using locale network R(emote) means using remote network B(anned) means to block it
func (*RouterRules) FromFile ¶ added in v1.18.2
func (r *RouterRules) FromFile(name string)
FromFile loads a RULE file.