libbox

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: GPL-2.0 Imports: 50 Imported by: 6

Documentation

Index

Constants

View Source
const (
	CommandLog int32 = iota
	CommandStatus
	CommandServiceStop
	CommandServiceReload
	CommandCloseConnections
)

Variables

This section is empty.

Functions

func CheckConfig added in v1.2.3

func CheckConfig(configContent string) error

func ClientCloseConnections added in v1.2.3

func ClientCloseConnections(sharedDirectory string) error

func ClientServiceReload added in v1.2.3

func ClientServiceReload(sharedDirectory string) error

func ClientServiceStop added in v1.2.3

func ClientServiceStop(sharedDirectory string) error

func FormatBytes

func FormatBytes(length int64) string

func FormatConfig added in v1.2.3

func FormatConfig(configContent string) (string, error)

func RedirectStderr added in v1.2.4

func RedirectStderr(path string) error

func SetBasePath

func SetBasePath(path string)

func Version

func Version() string

Types

type BoxService

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

func NewService

func NewService(configContent string, platformInterface PlatformInterface) (*BoxService, error)

func (*BoxService) Close

func (s *BoxService) Close() error

func (*BoxService) Start

func (s *BoxService) Start() error

type CommandClient added in v1.2.3

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

func NewCommandClient added in v1.2.3

func NewCommandClient(sharedDirectory string, handler CommandClientHandler, options *CommandClientOptions) *CommandClient

func (*CommandClient) Connect added in v1.2.3

func (c *CommandClient) Connect() error

func (*CommandClient) Disconnect added in v1.2.3

func (c *CommandClient) Disconnect() error

type CommandClientHandler added in v1.2.3

type CommandClientHandler interface {
	Connected()
	Disconnected(message string)
	WriteLog(message string)
	WriteStatus(message *StatusMessage)
}

type CommandClientOptions added in v1.2.3

type CommandClientOptions struct {
	Command        int32
	StatusInterval int64
}

type CommandServer added in v1.2.3

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

func NewCommandServer added in v1.2.3

func NewCommandServer(sharedDirectory string, handler CommandServerHandler) *CommandServer

func (*CommandServer) Close added in v1.2.3

func (s *CommandServer) Close() error

func (*CommandServer) Start added in v1.2.3

func (s *CommandServer) Start() error

func (*CommandServer) WriteMessage added in v1.2.3

func (s *CommandServer) WriteMessage(message string)

type CommandServerHandler added in v1.2.3

type CommandServerHandler interface {
	ServiceStop() error
	ServiceReload() error
}

type HTTPClient added in v1.2.3

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

func NewHTTPClient added in v1.2.3

func NewHTTPClient() HTTPClient

type HTTPRequest added in v1.2.3

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

type HTTPResponse added in v1.2.3

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

type InterfaceUpdateListener added in v1.2.5

type InterfaceUpdateListener interface {
	UpdateDefaultInterface(interfaceName string, interfaceIndex int32)
}

type NetworkInterface added in v1.2.5

type NetworkInterface struct {
	Index     int32
	MTU       int32
	Name      string
	Addresses StringIterator
}

type NetworkInterfaceIterator added in v1.2.5

type NetworkInterfaceIterator interface {
	Next() *NetworkInterface
	HasNext() bool
}

type OnDemandRule

type OnDemandRule interface {
	Target() int32
	DNSSearchDomainMatch() StringIterator
	DNSServerAddressMatch() StringIterator
	InterfaceTypeMatch() int32
	SSIDMatch() StringIterator
	ProbeURL() string
}

type OnDemandRuleIterator

type OnDemandRuleIterator interface {
	Next() OnDemandRule
	HasNext() bool
}

type PProfServer

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

func NewPProfServer

func NewPProfServer(port int) *PProfServer

func (*PProfServer) Close

func (s *PProfServer) Close() error

func (*PProfServer) Start

func (s *PProfServer) Start() error

type PlatformInterface

type PlatformInterface interface {
	UsePlatformAutoDetectInterfaceControl() bool
	AutoDetectInterfaceControl(fd int32) error
	OpenTun(options TunOptions) (int32, error)
	WriteLog(message string)
	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)
	UsePlatformDefaultInterfaceMonitor() bool
	StartDefaultInterfaceMonitor(listener InterfaceUpdateListener) error
	CloseDefaultInterfaceMonitor(listener InterfaceUpdateListener) error
	UsePlatformInterfaceGetter() bool
	GetInterfaces() (NetworkInterfaceIterator, error)
}

type RoutePrefix

type RoutePrefix struct {
	Address string
	Prefix  int32
}

func (*RoutePrefix) Mask

func (p *RoutePrefix) Mask() string

type RoutePrefixIterator

type RoutePrefixIterator interface {
	Next() *RoutePrefix
	HasNext() bool
}

type StatusMessage added in v1.2.3

type StatusMessage struct {
	Memory      int64
	Goroutines  int32
	Connections int32
}

type StringIterator

type StringIterator interface {
	Next() string
	HasNext() bool
}

type TunInterface

type TunInterface interface {
	FileDescriptor() int32
	Close() error
}

type TunOptions

type TunOptions interface {
	GetInet4Address() RoutePrefixIterator
	GetInet6Address() RoutePrefixIterator
	GetDNSServerAddress() (string, error)
	GetMTU() int32
	GetAutoRoute() bool
	GetStrictRoute() bool
	GetInet4RouteAddress() RoutePrefixIterator
	GetInet6RouteAddress() RoutePrefixIterator
	GetIncludePackage() StringIterator
	GetExcludePackage() StringIterator
	IsHTTPProxyEnabled() bool
	GetHTTPProxyServer() string
	GetHTTPProxyServerPort() int32
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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