yuhaiin

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRulesCidr

func AddRulesCidr(process AddRoute, rules string)

func DeleteCache

func DeleteCache(name string)

func InitDB

func InitDB(path string)

func NewUidDumper

func NewUidDumper(ud UidDumper) listener.ProcessDumper

Types

type AddRoute

type AddRoute interface {
	Add(*CIDR)
}

type App

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

func (*App) Running

func (a *App) Running() bool

func (*App) SaveNewBypass

func (a *App) SaveNewBypass(link string) error

func (*App) Start

func (a *App) Start(opt *Opts) error

func (*App) Stop

func (a *App) Stop() error

type Bypass

type Bypass struct {
	// 0: bypass, 1: proxy, 2: direct, 3: block
	TCP int32 `json:"tcp"`
	// 0: bypass, 1: proxy, 2: direct, 3: block
	UDP int32 `json:"udp"`

	Block  string `json:"block"`
	Proxy  string `json:"proxy"`
	Direct string `json:"direct"`
}

type CIDR

type CIDR struct {
	IP   string
	Mask int32
}

func ParseCIDR

func ParseCIDR(s string) (*CIDR, error)

type Cache

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

func NewCache

func NewCache(name string) *Cache

func (*Cache) Delete

func (c *Cache) Delete(k string)

func (*Cache) Get

func (c *Cache) Get(k string) string

func (*Cache) Put

func (c *Cache) Put(k, v string)

type Closer

type Closer interface {
	Close() error
}

type DNS

type DNS struct {
	Host string `json:"host"`
	// Type
	// 0: reserve
	// 1: udp
	// 2: tcp
	// 3: doh
	// 4: dot
	// 5: doq
	// 6: doh3
	Type          int32  `json:"type"`
	Subnet        string `json:"subnet"`
	TlsServername string `json:"tls_servername"`
}

type DNSSetting

type DNSSetting struct {
	Server              string `json:"server"`
	Fakedns             bool   `json:"fakedns"`
	FakednsIpRange      string `json:"fakedns_ip_range"`
	ResolveRemoteDomain bool   `json:"resolve_remote_domain"`
	Remote              *DNS   `json:"remote"`
	Local               *DNS   `json:"local"`
	Bootstrap           *DNS   `json:"bootstrap"`
	Hosts               []byte `json:"hosts"`
}

type Log

type Log struct {
	SaveLogcat bool `json:"save_logcat"`
	// 0:verbose, 1:debug, 2:info, 3:warning, 4:error, 5: fatal
	LogLevel int32 `json:"log_level"`
}

type Opts

type Opts struct {
	Host          string      `json:"host"`
	Savepath      string      `json:"savepath"`
	Socks5        string      `json:"socks5"`
	Http          string      `json:"http"`
	IPv6          bool        `json:"ipv6"`
	Bypass        *Bypass     `json:"bypass"`
	DNS           *DNSSetting `json:"dns"`
	TUN           *TUN        `json:"tun"`
	Log           *Log        `json:"log"`
	CloseFallback Closer
}

type SocketProtect

type SocketProtect interface {
	Protect(socket int32) bool
}

type TUN

type TUN struct {
	FD           int32  `json:"fd"`
	MTU          int32  `json:"mtu"`
	Portal       string `json:"portal"`
	PortalV6     string `json:"portal_v6"`
	DNSHijacking bool   `json:"dns_hijacking"`
	// Driver
	// 0: fdbased
	// 1: channel
	// 2: tun2socket
	// 3: tun2socket_gvisor
	Driver        int32 `json:"driver"`
	UidDumper     UidDumper
	SocketProtect SocketProtect
}

type UidDumper

type UidDumper interface {
	DumpUid(ipProto int32, srcIp string, srcPort int32, destIp string, destPort int32) (int32, error)
	GetUidInfo(uid int32) (string, error)
}

Jump to

Keyboard shortcuts

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