Documentation ¶
Index ¶
- Constants
- func CheckConfig(configContent string) error
- func ClearServiceError()
- func DecodeLengthChunk(data []byte) int32
- func EncodeChunkedMessage(data []byte) []byte
- func FormatBytes(length int64) string
- func FormatConfig(configContent string) (string, error)
- func FormatDuration(duration int64) string
- func FormatMemoryBytes(length int64) string
- func GenerateRemoteProfileImportLink(name string, remoteURL string) string
- func ProxyDisplayType(proxyType string) string
- func ReadServiceError() (string, error)
- func RedirectStderr(path string) error
- func RegisterLocalDNSTransport(transport LocalDNSTransport)
- func SetMemoryLimit(enabled bool)
- func Setup(basePath string, workingPath string, tempPath string, isTVOS bool)
- func SetupWithUsername(basePath string, workingPath string, tempPath string, username string) error
- func Version() string
- func WriteServiceError(message string) error
- type BoxService
- type CommandClient
- func (c *CommandClient) CloseConnection(connId string) error
- func (c *CommandClient) CloseConnections() error
- func (c *CommandClient) Connect() error
- func (c *CommandClient) Disconnect() error
- func (c *CommandClient) GetDeprecatedNotes() (DeprecatedNoteIterator, error)
- func (c *CommandClient) GetSystemProxyStatus() (*SystemProxyStatus, error)
- func (c *CommandClient) SelectOutbound(groupTag string, outboundTag string) error
- func (c *CommandClient) ServiceClose() error
- func (c *CommandClient) ServiceReload() error
- func (c *CommandClient) SetClashMode(newMode string) error
- func (c *CommandClient) SetGroupExpand(groupTag string, isExpand bool) error
- func (c *CommandClient) SetSystemProxyEnabled(isEnabled bool) error
- func (c *CommandClient) URLTest(groupTag string) error
- type CommandClientHandler
- type CommandClientOptions
- type CommandServer
- type CommandServerHandler
- type Connection
- type ConnectionIterator
- type Connections
- type DeprecatedNote
- type DeprecatedNoteIterator
- type ErrorMessage
- type ExchangeContext
- type Func
- type HTTPClient
- type HTTPRequest
- type HTTPResponse
- type ImportRemoteProfile
- type InterfaceUpdateListener
- type LocalDNSTransport
- type NetworkInterface
- type NetworkInterfaceIterator
- type Notification
- type OnDemandRule
- type OnDemandRuleIterator
- type OutboundGroup
- type OutboundGroupItem
- type OutboundGroupItemIterator
- type OutboundGroupIterator
- type PProfServer
- type PlatformInterface
- type ProfileContent
- type ProfileContentRequest
- type ProfileDecoder
- type ProfileEncoder
- type ProfilePreview
- type ProfilePreviewIterator
- type RoutePrefix
- type RoutePrefixIterator
- type StatusMessage
- type StringIterator
- type SystemProxyStatus
- type TunInterface
- type TunOptions
- type WIFIState
Constants ¶
View Source
const ( CommandLog int32 = iota CommandStatus CommandServiceReload CommandServiceClose CommandCloseConnections CommandGroup CommandSelectOutbound CommandURLTest CommandGroupExpand CommandClashMode CommandSetClashMode CommandGetSystemProxyStatus CommandSetSystemProxyEnabled CommandConnections CommandCloseConnection CommandGetDeprecatedNotes )
View Source
const ( ConnectionStateAll = iota ConnectionStateActive ConnectionStateClosed )
View Source
const ( InterfaceTypeWIFI = int32(C.InterfaceTypeWIFI) InterfaceTypeCellular = int32(C.InterfaceTypeCellular) InterfaceTypeEthernet = int32(C.InterfaceTypeEthernet) InterfaceTypeOther = int32(C.InterfaceTypeOther) )
View Source
const ( MessageTypeError = iota MessageTypeProfileList MessageTypeProfileContentRequest MessageTypeProfileContent )
View Source
const ( ProfileTypeLocal int32 = iota ProfileTypeiCloud ProfileTypeRemote )
Variables ¶
This section is empty.
Functions ¶
func CheckConfig ¶
func ClearServiceError ¶
func ClearServiceError()
func DecodeLengthChunk ¶
func EncodeChunkedMessage ¶
func FormatBytes ¶
func FormatConfig ¶
func FormatDuration ¶
func FormatMemoryBytes ¶
func ProxyDisplayType ¶
func ReadServiceError ¶
func RedirectStderr ¶
func RegisterLocalDNSTransport ¶
func RegisterLocalDNSTransport(transport LocalDNSTransport)
func SetMemoryLimit ¶
func SetMemoryLimit(enabled bool)
func SetupWithUsername ¶
func WriteServiceError ¶
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) NeedWIFIState ¶
func (s *BoxService) NeedWIFIState() bool
func (*BoxService) Pause ¶
func (s *BoxService) Pause()
func (*BoxService) ResetNetwork ¶
func (s *BoxService) ResetNetwork()
func (*BoxService) Start ¶
func (s *BoxService) Start() error
func (*BoxService) Wake ¶
func (s *BoxService) Wake()
type CommandClient ¶
type CommandClient struct {
// contains filtered or unexported fields
}
func NewCommandClient ¶
func NewCommandClient(handler CommandClientHandler, options *CommandClientOptions) *CommandClient
func NewStandaloneCommandClient ¶
func NewStandaloneCommandClient() *CommandClient
func (*CommandClient) CloseConnection ¶
func (c *CommandClient) CloseConnection(connId string) error
func (*CommandClient) CloseConnections ¶
func (c *CommandClient) CloseConnections() error
func (*CommandClient) Connect ¶
func (c *CommandClient) Connect() error
func (*CommandClient) Disconnect ¶
func (c *CommandClient) Disconnect() error
func (*CommandClient) GetDeprecatedNotes ¶
func (c *CommandClient) GetDeprecatedNotes() (DeprecatedNoteIterator, error)
func (*CommandClient) GetSystemProxyStatus ¶
func (c *CommandClient) GetSystemProxyStatus() (*SystemProxyStatus, error)
func (*CommandClient) SelectOutbound ¶
func (c *CommandClient) SelectOutbound(groupTag string, outboundTag string) error
func (*CommandClient) ServiceClose ¶
func (c *CommandClient) ServiceClose() error
func (*CommandClient) ServiceReload ¶
func (c *CommandClient) ServiceReload() error
func (*CommandClient) SetClashMode ¶
func (c *CommandClient) SetClashMode(newMode string) error
func (*CommandClient) SetGroupExpand ¶
func (c *CommandClient) SetGroupExpand(groupTag string, isExpand bool) error
func (*CommandClient) SetSystemProxyEnabled ¶
func (c *CommandClient) SetSystemProxyEnabled(isEnabled bool) error
func (*CommandClient) URLTest ¶
func (c *CommandClient) URLTest(groupTag string) error
type CommandClientHandler ¶
type CommandClientHandler interface { Connected() Disconnected(message string) ClearLogs() WriteLogs(messageList StringIterator) WriteStatus(message *StatusMessage) WriteGroups(message OutboundGroupIterator) InitializeClashMode(modeList StringIterator, currentMode string) UpdateClashMode(newMode string) WriteConnections(message *Connections) }
type CommandClientOptions ¶
type CommandServer ¶
type CommandServer struct {
// contains filtered or unexported fields
}
func NewCommandServer ¶
func NewCommandServer(handler CommandServerHandler, maxLines int32) *CommandServer
func (*CommandServer) Close ¶
func (s *CommandServer) Close() error
func (*CommandServer) ResetLog ¶
func (s *CommandServer) ResetLog()
func (*CommandServer) SetService ¶
func (s *CommandServer) SetService(newService *BoxService)
func (*CommandServer) Start ¶
func (s *CommandServer) Start() error
func (*CommandServer) WriteMessage ¶
func (s *CommandServer) WriteMessage(message string)
type CommandServerHandler ¶
type CommandServerHandler interface { ServiceReload() error PostServiceClose() GetSystemProxyStatus() *SystemProxyStatus SetSystemProxyEnabled(isEnabled bool) error }
type Connection ¶
type Connection struct { ID string Inbound string InboundType string IPVersion int32 Network string Source string Destination string Domain string Protocol string User string FromOutbound string CreatedAt int64 ClosedAt int64 Uplink int64 Downlink int64 UplinkTotal int64 DownlinkTotal int64 Rule string Outbound string OutboundType string ChainList []string }
func (*Connection) Chain ¶
func (c *Connection) Chain() StringIterator
func (*Connection) DisplayDestination ¶
func (c *Connection) DisplayDestination() string
type ConnectionIterator ¶
type ConnectionIterator interface { Next() *Connection HasNext() bool }
type Connections ¶
type Connections struct {
// contains filtered or unexported fields
}
func (*Connections) FilterState ¶
func (c *Connections) FilterState(state int32)
func (*Connections) Iterator ¶
func (c *Connections) Iterator() ConnectionIterator
func (*Connections) SortByDate ¶
func (c *Connections) SortByDate()
func (*Connections) SortByTraffic ¶
func (c *Connections) SortByTraffic()
func (*Connections) SortByTrafficTotal ¶
func (c *Connections) SortByTrafficTotal()
type DeprecatedNote ¶
type DeprecatedNote struct { Name string Description string DeprecatedVersion string ScheduledVersion string EnvName string MigrationLink string }
func (DeprecatedNote) Impending ¶
func (n DeprecatedNote) Impending() bool
func (DeprecatedNote) Message ¶
func (n DeprecatedNote) Message() string
func (DeprecatedNote) MessageWithLink ¶
func (n DeprecatedNote) MessageWithLink() string
type DeprecatedNoteIterator ¶
type DeprecatedNoteIterator interface { HasNext() bool Next() *DeprecatedNote }
type ErrorMessage ¶
type ErrorMessage struct {
Message string
}
func DecodeErrorMessage ¶
func DecodeErrorMessage(data []byte) (*ErrorMessage, error)
func (*ErrorMessage) Encode ¶
func (e *ErrorMessage) Encode() []byte
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 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 HTTPResponse ¶
type ImportRemoteProfile ¶
func ParseRemoteProfileImportLink ¶
func ParseRemoteProfileImportLink(importLink string) (*ImportRemoteProfile, error)
type InterfaceUpdateListener ¶
type LocalDNSTransport ¶
type LocalDNSTransport interface { Raw() bool Lookup(ctx *ExchangeContext, network string, domain string) error Exchange(ctx *ExchangeContext, message []byte) error }
type NetworkInterface ¶
type NetworkInterface struct { Index int32 MTU int32 Name string Addresses StringIterator Flags int32 Type int32 DNSServer StringIterator Metered bool }
type NetworkInterfaceIterator ¶
type NetworkInterfaceIterator interface { Next() *NetworkInterface HasNext() bool }
type Notification ¶
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 OutboundGroup ¶
type OutboundGroup struct { Tag string Type string Selectable bool Selected string IsExpand bool ItemList []*OutboundGroupItem }
func (*OutboundGroup) GetItems ¶
func (g *OutboundGroup) GetItems() OutboundGroupItemIterator
type OutboundGroupItem ¶
type OutboundGroupItemIterator ¶
type OutboundGroupItemIterator interface { Next() *OutboundGroupItem HasNext() bool }
type OutboundGroupIterator ¶
type OutboundGroupIterator interface { Next() *OutboundGroup 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) StartDefaultInterfaceMonitor(listener InterfaceUpdateListener) error CloseDefaultInterfaceMonitor(listener InterfaceUpdateListener) error GetInterfaces() (NetworkInterfaceIterator, error) UnderNetworkExtension() bool IncludeAllNetworks() bool ReadWIFIState() *WIFIState ClearDNSCache() SendNotification(notification *Notification) error }
type ProfileContent ¶
type ProfileContent struct { Name string Type int32 Config string RemotePath string AutoUpdate bool AutoUpdateInterval int32 LastUpdated int64 }
func DecodeProfileContent ¶
func DecodeProfileContent(data []byte) (*ProfileContent, error)
func (*ProfileContent) Encode ¶
func (c *ProfileContent) Encode() []byte
type ProfileContentRequest ¶
type ProfileContentRequest struct {
ProfileID int64
}
func DecodeProfileContentRequest ¶
func DecodeProfileContentRequest(data []byte) (*ProfileContentRequest, error)
func (*ProfileContentRequest) Encode ¶
func (r *ProfileContentRequest) Encode() []byte
type ProfileDecoder ¶
type ProfileDecoder struct {
// contains filtered or unexported fields
}
func (*ProfileDecoder) Decode ¶
func (d *ProfileDecoder) Decode(data []byte) error
func (*ProfileDecoder) Iterator ¶
func (d *ProfileDecoder) Iterator() ProfilePreviewIterator
type ProfileEncoder ¶
type ProfileEncoder struct {
// contains filtered or unexported fields
}
func (*ProfileEncoder) Append ¶
func (e *ProfileEncoder) Append(profile *ProfilePreview)
func (*ProfileEncoder) Encode ¶
func (e *ProfileEncoder) Encode() []byte
type ProfilePreview ¶
type ProfilePreviewIterator ¶
type ProfilePreviewIterator interface { Next() *ProfilePreview HasNext() bool }
type RoutePrefix ¶
type RoutePrefix struct {
// contains filtered or unexported fields
}
func (*RoutePrefix) Address ¶
func (p *RoutePrefix) Address() string
func (*RoutePrefix) Mask ¶
func (p *RoutePrefix) Mask() string
func (*RoutePrefix) Prefix ¶
func (p *RoutePrefix) Prefix() int32
func (*RoutePrefix) String ¶
func (p *RoutePrefix) String() string
type RoutePrefixIterator ¶
type RoutePrefixIterator interface { Next() *RoutePrefix HasNext() bool }
type StatusMessage ¶
type StringIterator ¶
type SystemProxyStatus ¶
type TunInterface ¶
type TunOptions ¶
type TunOptions interface { GetInet4Address() RoutePrefixIterator GetInet6Address() RoutePrefixIterator GetDNSServerAddress() (string, error) GetMTU() int32 GetAutoRoute() bool GetStrictRoute() bool GetInet4RouteAddress() RoutePrefixIterator GetInet6RouteAddress() RoutePrefixIterator GetInet4RouteExcludeAddress() RoutePrefixIterator GetInet6RouteExcludeAddress() RoutePrefixIterator GetInet4RouteRange() RoutePrefixIterator GetInet6RouteRange() RoutePrefixIterator GetIncludePackage() StringIterator GetExcludePackage() StringIterator IsHTTPProxyEnabled() bool GetHTTPProxyServer() string GetHTTPProxyServerPort() int32 GetHTTPProxyBypassDomain() StringIterator GetHTTPProxyMatchDomain() StringIterator }
Source Files ¶
- command.go
- command_clash_mode.go
- command_client.go
- command_close_connection.go
- command_connections.go
- command_conntrack.go
- command_deprecated_report.go
- command_group.go
- command_log.go
- command_power.go
- command_select.go
- command_server.go
- command_shared.go
- command_status.go
- command_system_proxy.go
- command_urltest.go
- config.go
- deprecated.go
- dns.go
- http.go
- iterator.go
- link_flags_unix.go
- log.go
- memory.go
- monitor.go
- platform.go
- pprof.go
- profile_import.go
- remote_profile.go
- service.go
- service_error.go
- service_other.go
- service_pause.go
- setup.go
- tun.go
- tun_name_linux.go
Click to show internal directories.
Click to hide internal directories.