Documentation
¶
Index ¶
- Constants
- func AvailablePort(startPort int32) (int32, error)
- func CheckConfig(configContent string) error
- func CompareSemver(left string, right string) bool
- func DecodeLengthChunk(data []byte) int32
- func EncodeChunkedMessage(data []byte) []byte
- func FormatBytes(length int64) string
- func FormatDuration(duration int64) string
- func FormatMemoryBytes(length int64) string
- func GenerateRemoteProfileImportLink(name string, remoteURL string) string
- func ProxyDisplayType(proxyType string) string
- func RedirectStderr(path string) error
- func SetLocale(localeId string)
- func SetMemoryLimit(enabled bool)
- func SetXPCDialer(dialer XPCDialer)
- func Setup(options *SetupOptions) error
- func Version() string
- type CommandClient
- func (c *CommandClient) ClearLogs() error
- func (c *CommandClient) CloseConnection(connId string) error
- func (c *CommandClient) CloseConnections() error
- func (c *CommandClient) Connect() error
- func (c *CommandClient) ConnectWithFD(fd int32) error
- func (c *CommandClient) Disconnect() error
- func (c *CommandClient) GetDeprecatedNotes() (DeprecatedNoteIterator, error)
- func (c *CommandClient) GetStartedAt() (int64, 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
- func (s *CommandServer) Close()
- func (s *CommandServer) CloseService() error
- func (s *CommandServer) NeedFindProcess() bool
- func (s *CommandServer) NeedWIFIState() bool
- func (s *CommandServer) Pause()
- func (s *CommandServer) ResetNetwork()
- func (s *CommandServer) SetError(message string)
- func (s *CommandServer) Start() error
- func (s *CommandServer) StartOrReloadService(configContent string, options *OverrideOptions) error
- func (s *CommandServer) UpdateWIFIState()
- func (s *CommandServer) Wake()
- func (s *CommandServer) WriteMessage(level int32, message string)
- type CommandServerHandler
- type Connection
- type ConnectionEvent
- type ConnectionEventIterator
- type ConnectionEvents
- type ConnectionIterator
- type ConnectionOwner
- type Connections
- type DeprecatedNote
- type DeprecatedNoteIterator
- type ErrorMessage
- type ExchangeContext
- type FDroidMirror
- type FDroidMirrorIterator
- type FDroidPingResult
- type FDroidPingResultIterator
- type FDroidUpdateInfo
- type Func
- type HTTPClient
- type HTTPRequest
- type HTTPResponse
- type ImportRemoteProfile
- type Int32Iterator
- type InterfaceUpdateListener
- type LocalDNSTransport
- type LogEntry
- type LogIterator
- type NetworkInterface
- type NetworkInterfaceIterator
- type Notification
- type OnDemandRule
- type OnDemandRuleIterator
- type OutboundGroup
- type OutboundGroupItem
- type OutboundGroupItemIterator
- type OutboundGroupIterator
- type OverrideOptions
- type PProfServer
- type PlatformInterface
- type ProcessInfo
- type ProfileContent
- type ProfileContentRequest
- type ProfileDecoder
- type ProfileEncoder
- type ProfilePreview
- type ProfilePreviewIterator
- type RoutePrefix
- type RoutePrefixIterator
- type SetupOptions
- type StatusMessage
- type StringBox
- type StringIterator
- type SystemProxyStatus
- type TunOptions
- type WIFIState
- type XPCDialer
Constants ¶
View Source
const ( CommandLog int32 = iota CommandStatus CommandGroup CommandClashMode CommandConnections )
View Source
const ( ConnectionStateAll = iota ConnectionStateActive ConnectionStateClosed )
View Source
const ( ConnectionEventNew = iota ConnectionEventUpdate ConnectionEventClosed )
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 AvailablePort ¶ added in v1.13.0
func CheckConfig ¶ added in v1.2.3
func CompareSemver ¶ added in v1.13.0
func DecodeLengthChunk ¶ added in v1.3.5
func EncodeChunkedMessage ¶ added in v1.3.5
func FormatBytes ¶
func FormatDuration ¶ added in v1.10.0
func FormatMemoryBytes ¶ added in v1.4.4
func GenerateRemoteProfileImportLink ¶ added in v1.3.5
func ProxyDisplayType ¶ added in v1.3.6
func RedirectStderr ¶ added in v1.2.4
func SetMemoryLimit ¶ added in v1.3.3
func SetMemoryLimit(enabled bool)
func SetXPCDialer ¶ added in v1.13.0
func SetXPCDialer(dialer XPCDialer)
func Setup ¶ added in v1.3.0
func Setup(options *SetupOptions) error
Types ¶
type CommandClient ¶ added in v1.2.3
type CommandClient struct {
// contains filtered or unexported fields
}
func NewCommandClient ¶ added in v1.2.3
func NewCommandClient(handler CommandClientHandler, options *CommandClientOptions) *CommandClient
func NewStandaloneCommandClient ¶ added in v1.3.3
func NewStandaloneCommandClient() *CommandClient
func (*CommandClient) ClearLogs ¶ added in v1.13.0
func (c *CommandClient) ClearLogs() error
func (*CommandClient) CloseConnection ¶ added in v1.10.0
func (c *CommandClient) CloseConnection(connId string) error
func (*CommandClient) CloseConnections ¶ added in v1.3.3
func (c *CommandClient) CloseConnections() error
func (*CommandClient) Connect ¶ added in v1.2.3
func (c *CommandClient) Connect() error
func (*CommandClient) ConnectWithFD ¶ added in v1.13.0
func (c *CommandClient) ConnectWithFD(fd int32) error
func (*CommandClient) Disconnect ¶ added in v1.2.3
func (c *CommandClient) Disconnect() error
func (*CommandClient) GetDeprecatedNotes ¶ added in v1.10.2
func (c *CommandClient) GetDeprecatedNotes() (DeprecatedNoteIterator, error)
func (*CommandClient) GetStartedAt ¶ added in v1.13.0
func (c *CommandClient) GetStartedAt() (int64, error)
func (*CommandClient) GetSystemProxyStatus ¶ added in v1.4.2
func (c *CommandClient) GetSystemProxyStatus() (*SystemProxyStatus, error)
func (*CommandClient) SelectOutbound ¶ added in v1.3.3
func (c *CommandClient) SelectOutbound(groupTag string, outboundTag string) error
func (*CommandClient) ServiceClose ¶ added in v1.8.9
func (c *CommandClient) ServiceClose() error
func (*CommandClient) ServiceReload ¶ added in v1.3.3
func (c *CommandClient) ServiceReload() error
func (*CommandClient) SetClashMode ¶ added in v1.4.0
func (c *CommandClient) SetClashMode(newMode string) error
func (*CommandClient) SetGroupExpand ¶ added in v1.4.0
func (c *CommandClient) SetGroupExpand(groupTag string, isExpand bool) error
func (*CommandClient) SetSystemProxyEnabled ¶ added in v1.4.2
func (c *CommandClient) SetSystemProxyEnabled(isEnabled bool) error
func (*CommandClient) URLTest ¶ added in v1.3.3
func (c *CommandClient) URLTest(groupTag string) error
type CommandClientHandler ¶ added in v1.2.3
type CommandClientHandler interface {
Connected()
Disconnected(message string)
SetDefaultLogLevel(level int32)
ClearLogs()
WriteLogs(messageList LogIterator)
WriteStatus(message *StatusMessage)
WriteGroups(message OutboundGroupIterator)
InitializeClashMode(modeList StringIterator, currentMode string)
UpdateClashMode(newMode string)
WriteConnectionEvents(events *ConnectionEvents)
}
type CommandClientOptions ¶ added in v1.2.3
type CommandClientOptions struct {
StatusInterval int64
// contains filtered or unexported fields
}
func (*CommandClientOptions) AddCommand ¶ added in v1.13.0
func (o *CommandClientOptions) AddCommand(command int32)
type CommandServer ¶ added in v1.2.3
type CommandServer struct {
*daemon.StartedService
// contains filtered or unexported fields
}
func NewCommandServer ¶ added in v1.2.3
func NewCommandServer(handler CommandServerHandler, platformInterface PlatformInterface) (*CommandServer, error)
func (*CommandServer) Close ¶ added in v1.2.3
func (s *CommandServer) Close()
func (*CommandServer) CloseService ¶ added in v1.13.0
func (s *CommandServer) CloseService() error
func (*CommandServer) NeedFindProcess ¶ added in v1.13.0
func (s *CommandServer) NeedFindProcess() bool
func (*CommandServer) NeedWIFIState ¶ added in v1.13.0
func (s *CommandServer) NeedWIFIState() bool
func (*CommandServer) Pause ¶ added in v1.13.0
func (s *CommandServer) Pause()
func (*CommandServer) ResetNetwork ¶ added in v1.13.0
func (s *CommandServer) ResetNetwork()
func (*CommandServer) SetError ¶ added in v1.13.0
func (s *CommandServer) SetError(message string)
func (*CommandServer) Start ¶ added in v1.2.3
func (s *CommandServer) Start() error
func (*CommandServer) StartOrReloadService ¶ added in v1.13.0
func (s *CommandServer) StartOrReloadService(configContent string, options *OverrideOptions) error
func (*CommandServer) UpdateWIFIState ¶ added in v1.13.0
func (s *CommandServer) UpdateWIFIState()
func (*CommandServer) Wake ¶ added in v1.13.0
func (s *CommandServer) Wake()
func (*CommandServer) WriteMessage ¶ added in v1.2.3
func (s *CommandServer) WriteMessage(level int32, message string)
type CommandServerHandler ¶ added in v1.2.3
type Connection ¶ added in v1.10.0
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
ProcessInfo *ProcessInfo
// contains filtered or unexported fields
}
func (*Connection) Chain ¶ added in v1.10.0
func (c *Connection) Chain() StringIterator
func (*Connection) DisplayDestination ¶ added in v1.10.0
func (c *Connection) DisplayDestination() string
type ConnectionEvent ¶ added in v1.13.0
type ConnectionEventIterator ¶ added in v1.13.0
type ConnectionEventIterator interface {
Next() *ConnectionEvent
HasNext() bool
}
type ConnectionEvents ¶ added in v1.13.0
type ConnectionEvents struct {
Reset bool
// contains filtered or unexported fields
}
func (*ConnectionEvents) Iterator ¶ added in v1.13.0
func (c *ConnectionEvents) Iterator() ConnectionEventIterator
type ConnectionIterator ¶ added in v1.10.0
type ConnectionIterator interface {
Next() *Connection
HasNext() bool
}
type ConnectionOwner ¶ added in v1.13.0
type Connections ¶ added in v1.10.0
type Connections struct {
// contains filtered or unexported fields
}
func NewConnections ¶ added in v1.13.0
func NewConnections() *Connections
func (*Connections) ApplyEvents ¶ added in v1.13.0
func (c *Connections) ApplyEvents(events *ConnectionEvents)
func (*Connections) FilterState ¶ added in v1.10.0
func (c *Connections) FilterState(state int32)
func (*Connections) Iterator ¶ added in v1.10.0
func (c *Connections) Iterator() ConnectionIterator
func (*Connections) SortByDate ¶ added in v1.10.0
func (c *Connections) SortByDate()
func (*Connections) SortByTraffic ¶ added in v1.10.0
func (c *Connections) SortByTraffic()
func (*Connections) SortByTrafficTotal ¶ added in v1.10.0
func (c *Connections) SortByTrafficTotal()
type DeprecatedNote ¶ added in v1.10.2
type DeprecatedNote struct {
Name string
Description string
DeprecatedVersion string
ScheduledVersion string
EnvName string
MigrationLink string
}
func (DeprecatedNote) Impending ¶ added in v1.10.2
func (n DeprecatedNote) Impending() bool
func (DeprecatedNote) Message ¶ added in v1.10.2
func (n DeprecatedNote) Message() string
func (DeprecatedNote) MessageWithLink ¶ added in v1.10.2
func (n DeprecatedNote) MessageWithLink() string
type DeprecatedNoteIterator ¶ added in v1.10.2
type DeprecatedNoteIterator interface {
HasNext() bool
Next() *DeprecatedNote
}
type ErrorMessage ¶ added in v1.3.5
type ErrorMessage struct {
Message string
}
func DecodeErrorMessage ¶ added in v1.3.5
func DecodeErrorMessage(data []byte) (*ErrorMessage, error)
func (*ErrorMessage) Encode ¶ added in v1.3.5
func (e *ErrorMessage) Encode() []byte
type ExchangeContext ¶ added in v1.3.0
type ExchangeContext struct {
// contains filtered or unexported fields
}
func (*ExchangeContext) ErrnoCode ¶ added in v1.3.0
func (c *ExchangeContext) ErrnoCode(code int32)
func (*ExchangeContext) ErrorCode ¶ added in v1.3.0
func (c *ExchangeContext) ErrorCode(code int32)
func (*ExchangeContext) OnCancel ¶ added in v1.3.0
func (c *ExchangeContext) OnCancel(callback Func)
func (*ExchangeContext) RawSuccess ¶ added in v1.3.0
func (c *ExchangeContext) RawSuccess(result []byte)
func (*ExchangeContext) Success ¶ added in v1.3.0
func (c *ExchangeContext) Success(result string)
type FDroidMirror ¶ added in v1.13.3
type FDroidMirrorIterator ¶ added in v1.13.3
type FDroidMirrorIterator interface {
Len() int32
HasNext() bool
Next() *FDroidMirror
}
func GetFDroidMirrors ¶ added in v1.13.3
func GetFDroidMirrors() FDroidMirrorIterator
type FDroidPingResult ¶ added in v1.13.3
func PingFDroidMirror ¶ added in v1.13.3
func PingFDroidMirror(mirrorURL string) *FDroidPingResult
type FDroidPingResultIterator ¶ added in v1.13.3
type FDroidPingResultIterator interface {
Len() int32
HasNext() bool
Next() *FDroidPingResult
}
func PingFDroidMirrors ¶ added in v1.13.3
func PingFDroidMirrors(mirrorURLs string) (FDroidPingResultIterator, error)
type FDroidUpdateInfo ¶ added in v1.13.3
type FDroidUpdateInfo struct {
VersionCode int32
VersionName string
DownloadURL string
FileSize int64
FileSHA256 string
}
func CheckFDroidUpdate ¶ added in v1.13.3
func CheckFDroidUpdate(mirrorURL, packageName string, currentVersionCode int32, cachePath string) (*FDroidUpdateInfo, 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 HTTPResponse ¶ added in v1.2.3
type ImportRemoteProfile ¶ added in v1.3.5
func ParseRemoteProfileImportLink ¶ added in v1.3.5
func ParseRemoteProfileImportLink(importLink string) (*ImportRemoteProfile, error)
type Int32Iterator ¶ added in v1.13.0
type InterfaceUpdateListener ¶ added in v1.2.5
type LocalDNSTransport ¶ added in v1.3.0
type LocalDNSTransport interface {
Raw() bool
Lookup(ctx *ExchangeContext, network string, domain string) error
Exchange(ctx *ExchangeContext, message []byte) error
}
type LogIterator ¶ added in v1.13.0
type NetworkInterface ¶ added in v1.2.5
type NetworkInterface struct {
Index int32
MTU int32
Name string
Addresses StringIterator
Flags int32
Type int32
DNSServer StringIterator
Metered bool
}
type NetworkInterfaceIterator ¶ added in v1.2.5
type NetworkInterfaceIterator interface {
Next() *NetworkInterface
HasNext() bool
}
type Notification ¶ added in v1.10.2
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 ¶ added in v1.3.3
type OutboundGroup struct {
Tag string
Type string
Selectable bool
Selected string
IsExpand bool
// contains filtered or unexported fields
}
func (*OutboundGroup) GetItems ¶ added in v1.3.3
func (g *OutboundGroup) GetItems() OutboundGroupItemIterator
type OutboundGroupItem ¶ added in v1.3.3
type OutboundGroupItemIterator ¶ added in v1.3.3
type OutboundGroupItemIterator interface {
Next() *OutboundGroupItem
HasNext() bool
}
type OutboundGroupIterator ¶ added in v1.3.3
type OutboundGroupIterator interface {
Next() *OutboundGroup
HasNext() bool
}
type OverrideOptions ¶ added in v1.13.0
type OverrideOptions struct {
AutoRedirect bool
IncludePackage StringIterator
ExcludePackage StringIterator
}
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 {
LocalDNSTransport() LocalDNSTransport
UsePlatformAutoDetectInterfaceControl() bool
AutoDetectInterfaceControl(fd int32) error
OpenTun(options TunOptions) (int32, error)
UseProcFS() bool
FindConnectionOwner(ipProtocol int32, sourceAddress string, sourcePort int32, destinationAddress string, destinationPort int32) (*ConnectionOwner, error)
StartDefaultInterfaceMonitor(listener InterfaceUpdateListener) error
CloseDefaultInterfaceMonitor(listener InterfaceUpdateListener) error
GetInterfaces() (NetworkInterfaceIterator, error)
UnderNetworkExtension() bool
IncludeAllNetworks() bool
ReadWIFIState() *WIFIState
SystemCertificates() StringIterator
ClearDNSCache()
SendNotification(notification *Notification) error
}
type ProcessInfo ¶ added in v1.13.0
type ProfileContent ¶ added in v1.3.5
type ProfileContent struct {
Name string
Type int32
Config string
RemotePath string
AutoUpdate bool
AutoUpdateInterval int32
LastUpdated int64
}
func DecodeProfileContent ¶ added in v1.3.5
func DecodeProfileContent(data []byte) (*ProfileContent, error)
func (*ProfileContent) Encode ¶ added in v1.3.5
func (c *ProfileContent) Encode() []byte
type ProfileContentRequest ¶ added in v1.3.5
type ProfileContentRequest struct {
ProfileID int64
}
func DecodeProfileContentRequest ¶ added in v1.3.5
func DecodeProfileContentRequest(data []byte) (*ProfileContentRequest, error)
func (*ProfileContentRequest) Encode ¶ added in v1.3.5
func (r *ProfileContentRequest) Encode() []byte
type ProfileDecoder ¶ added in v1.3.5
type ProfileDecoder struct {
// contains filtered or unexported fields
}
func (*ProfileDecoder) Decode ¶ added in v1.3.5
func (d *ProfileDecoder) Decode(data []byte) error
func (*ProfileDecoder) Iterator ¶ added in v1.3.5
func (d *ProfileDecoder) Iterator() ProfilePreviewIterator
type ProfileEncoder ¶ added in v1.3.5
type ProfileEncoder struct {
// contains filtered or unexported fields
}
func (*ProfileEncoder) Append ¶ added in v1.3.5
func (e *ProfileEncoder) Append(profile *ProfilePreview)
func (*ProfileEncoder) Encode ¶ added in v1.3.5
func (e *ProfileEncoder) Encode() []byte
type ProfilePreview ¶ added in v1.3.5
type ProfilePreviewIterator ¶ added in v1.3.5
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 ¶ added in v1.7.5
func (p *RoutePrefix) String() string
type RoutePrefixIterator ¶
type RoutePrefixIterator interface {
Next() *RoutePrefix
HasNext() bool
}
type SetupOptions ¶ added in v1.10.6
type StatusMessage ¶ added in v1.2.3
type StringBox ¶ added in v1.10.4
type StringBox struct {
Value string
}
func FormatConfig ¶ added in v1.2.3
type StringIterator ¶
type SystemProxyStatus ¶ added in v1.4.2
type TunOptions ¶
type TunOptions interface {
GetInet4Address() RoutePrefixIterator
GetInet6Address() RoutePrefixIterator
GetDNSServerAddress() (*StringBox, 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
}
type WIFIState ¶ added in v1.7.0
func NewWIFIState ¶ added in v1.7.0
Source Files
¶
- command.go
- command_client.go
- command_server.go
- command_types.go
- config.go
- deprecated.go
- dns.go
- fdroid.go
- fdroid_mirrors.go
- http.go
- iterator.go
- link_flags_unix.go
- log.go
- memory.go
- monitor.go
- panic.go
- platform.go
- pprof.go
- profile_import.go
- remote_profile.go
- semver.go
- service.go
- service_other.go
- setup.go
- tun.go
- tun_name_linux.go
Click to show internal directories.
Click to hide internal directories.