libcore

package module
v0.0.0-...-41fd5c6 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: GPL-2.0 Imports: 64 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForceGc

func ForceGc()

func InitCore

func InitCore(process, cachePath, internalAssets, externalAssets string,
	maxLogSizeKb int32, logEnable bool,
	if1 NB4AInterface, if2 BoxPlatformInterface,
)

func NekoLogClear

func NekoLogClear()

func NekoLogPrintln

func NekoLogPrintln(s string)

func RegisterLocalDNSTransport

func RegisterLocalDNSTransport(transport LocalDNSTransport)

func ResetAllConnections

func ResetAllConnections(system bool)

func Sha1

func Sha1(data []byte) []byte

func Sha256Hex

func Sha256Hex(data []byte) string

func Unxz

func Unxz(archive string, path string) error

func Unzip

func Unzip(archive string, path string) error

func UrlTest

func UrlTest(i *BoxInstance, link string, timeout int32) (latency int32, err error)

func VersionBox

func VersionBox() string

Types

type BoxInstance

type BoxInstance struct {
	*boxbox.Box

	ForTest bool
	// contains filtered or unexported fields
}

func NewSingBoxInstance

func NewSingBoxInstance(config string) (b *BoxInstance, err error)

func (*BoxInstance) Close

func (b *BoxInstance) Close() (err error)

func (*BoxInstance) QueryStats

func (b *BoxInstance) QueryStats(tag, direct string) int64

func (*BoxInstance) SelectOutbound

func (b *BoxInstance) SelectOutbound(tag string) bool

func (*BoxInstance) SetAsMain

func (b *BoxInstance) SetAsMain()

func (*BoxInstance) SetConnectionPoolEnabled

func (b *BoxInstance) SetConnectionPoolEnabled(enable bool)

func (*BoxInstance) SetV2rayStats

func (b *BoxInstance) SetV2rayStats(outbounds string)

func (*BoxInstance) Sleep

func (b *BoxInstance) Sleep()

func (*BoxInstance) Start

func (b *BoxInstance) Start() (err error)

func (*BoxInstance) Wake

func (b *BoxInstance) Wake()

type BoxPlatformInterface

type BoxPlatformInterface interface {
	AutoDetectInterfaceControl(fd int32) error
	OpenTun(singTunOptionsJson, tunPlatformOptionsJson string) (int, error)
	UseProcFS() bool
	FindConnectionOwner(ipProtocol int32, sourceAddress string, sourcePort int32, destinationAddress string, destinationPort int32) (int32, error)
	PackageNameByUid(uid int32) (string, error)
	UIDByPackageName(packageName string) (int32, error)
	WIFIState() string
}

type ExchangeContext

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

func (*ExchangeContext) ErrnoCode

func (c *ExchangeContext) ErrnoCode(code int32)

func (*ExchangeContext) ErrorCode

func (c *ExchangeContext) ErrorCode(code int32)

func (*ExchangeContext) OnCancel

func (c *ExchangeContext) OnCancel(callback Func)

func (*ExchangeContext) RawSuccess

func (c *ExchangeContext) RawSuccess(result []byte)

func (*ExchangeContext) Success

func (c *ExchangeContext) Success(result string)

type Func

type Func interface {
	Invoke() error
}

type Geoip

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

func NewGeoip

func NewGeoip() *Geoip

func (*Geoip) ConvertGeoip

func (g *Geoip) ConvertGeoip(countryCode, outputPath string)

func (*Geoip) OpenGeosite

func (g *Geoip) OpenGeosite(path string) bool

type Geosite

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

func (*Geosite) CheckGeositeCode

func (g *Geosite) CheckGeositeCode(path string, code string) bool

func (*Geosite) ConvertGeosite

func (g *Geosite) ConvertGeosite(code string, outputPath string)

ConvertGeosite need to run CheckGeositeCode first

type HTTPClient

type HTTPClient interface {
	RestrictedTLS()
	ModernTLS()
	PinnedTLS12()
	PinnedSHA256(sumHex string)
	TrySocks5(port int32)
	KeepAlive()
	NewRequest() HTTPRequest
	Close()
}

func NewHttpClient

func NewHttpClient() HTTPClient

type HTTPRequest

type HTTPRequest interface {
	SetURL(link string) error
	SetMethod(method string)
	SetHeader(key string, value string)
	SetContent(content []byte)
	SetContentString(content string)
	SetUserAgent(userAgent string)
	AllowInsecure()
	Execute() (HTTPResponse, error)
}

type HTTPResponse

type HTTPResponse interface {
	GetHeader(string) string
	GetContent() ([]byte, error)
	GetContentString() (string, error)
	WriteTo(path string) error
}

type LocalDNSTransport

type LocalDNSTransport interface {
	Raw() bool
	Lookup(ctx *ExchangeContext, network string, domain string) error
	Exchange(ctx *ExchangeContext, message []byte) error
}

type NB4AInterface

type NB4AInterface interface {
	UseOfficialAssets() bool
	Selector_OnProxySelected(selectorTag string, tag string)
}

type StunResult

type StunResult struct {
	Text    string
	Success bool
}

func StunTest

func StunTest(server string) *StunResult

Directories

Path Synopsis
Package stun is a STUN (RFC 3489 and RFC 5389) client implementation in golang.
Package stun is a STUN (RFC 3489 and RFC 5389) client implementation in golang.

Jump to

Keyboard shortcuts

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