Documentation
¶
Index ¶
- Constants
- Variables
- func CheckSecurityFeature(ctx context.Context, feature string) error
- func DNSResponseAddresses(response *dns.Msg) []netip.Addr
- func IsFinalAction(action RuleAction) bool
- func JudgeFlow(router Router, inbound string, inboundType string, network uint8, ...) tun.FlowVerdict
- func LegacyStart(starter any, stage StartStage) error
- func LogElapsed(logger log.ContextLogger, description ...any) func()
- func NormalizeWIFIBSSID(bssid string) string
- func OutboundTag(detour Outbound) string
- func OverrideContext(ctx context.Context) context.Context
- func RootPoolFromContext(ctx context.Context) *x509.CertPool
- func Start(logger log.ContextLogger, stage StartStage, services ...Lifecycle) error
- func StartNamed(logger log.ContextLogger, stage StartStage, services []LifecycleService) error
- func UpstreamMetadata(metadata InboundContext) M.Metadatadeprecated
- func WithContext(ctx context.Context, inboundContext *InboundContext) context.Context
- type ACMECertificateProvider
- type BridgeOptions
- type BridgeSession
- type CacheFile
- type CertificateProvider
- type CertificateProviderManager
- type CertificateProviderRegistry
- type CertificateProviderService
- type CertificateStore
- type ClashServer
- type ConnectionHandler
- type ConnectionHandlerFunc
- type ConnectionManager
- type ConnectionOwner
- type ConnectionRouterdeprecated
- type ConnectionRouterEx
- type ConnectionTracker
- type DNSCacheStore
- type DNSClient
- type DNSQueryOptions
- type DNSRouter
- type DNSRule
- type DNSRuleSetUpdateValidator
- type DNSTransport
- type DNSTransportManager
- type DNSTransportRegistry
- type DNSTransportWithPreferredDomain
- type Endpoint
- type EndpointManager
- type EndpointRegistry
- type FakeIPMetadata
- type FakeIPStorage
- type FakeIPStore
- type FakeIPTransport
- type FindConnectionOwnerRequest
- type FlowOutbound
- type HTTPClientManager
- type HTTPStartContext
- type HTTPTransport
- type HeadlessRule
- type Inbound
- type InboundContext
- type InboundManager
- type InboundRegistry
- type InterfaceUpdateListener
- type LegacyConnectionHandlerFunc
- type LegacyPacketConnectionHandlerFunc
- type LegacyUpstreamHandlerAdapter
- func NewLegacyRouteContextHandler(router ConnectionRouter, logger logger.ContextLogger) LegacyUpstreamHandlerAdapterdeprecated
- func NewLegacyRouteHandler(metadata InboundContext, router ConnectionRouter, logger logger.ContextLogger) LegacyUpstreamHandlerAdapterdeprecated
- func NewLegacyUpstreamContextHandler(connectionHandler LegacyConnectionHandlerFunc, ...) LegacyUpstreamHandlerAdapterdeprecated
- func NewLegacyUpstreamHandler(metadata InboundContext, connectionHandler LegacyConnectionHandlerFunc, ...) LegacyUpstreamHandlerAdapter
- type Lifecycle
- type LifecycleService
- type ManagedSSMServer
- type NeighborEntry
- type NeighborResolver
- type NeighborUpdateListener
- type NetworkInterface
- type NetworkManager
- type NetworkNamespaceManager
- type NetworkOptions
- type Notification
- type OOBPacketHandler
- type OpenConnectAuthChallenge
- type OpenConnectAuthForm
- type OpenConnectAuthFormChoice
- type OpenConnectAuthFormField
- type OpenConnectAuthFormResponse
- type OpenConnectAuthResponse
- type OpenConnectBrowserCookie
- type OpenConnectBrowserHeader
- type OpenConnectBrowserRequest
- type OpenConnectBrowserResult
- type OpenConnectEndpoint
- type OpenConnectStatus
- type OpenConnectTunnelInfo
- type OpenVPNChallenge
- type OpenVPNChallengeResponse
- type OpenVPNEndpoint
- type OpenVPNStatus
- type OpenVPNTunnelInfo
- type Outbound
- type OutboundGroup
- type OutboundManager
- type OutboundRegistry
- type OutboundWithMultiplex
- type OutboundWithPreferredRoutes
- type PacketBatchHandler
- type PacketConnectionHandler
- type PacketConnectionHandlerFunc
- type PacketHandler
- type PlatformInterface
- type PlatformUser
- type PreMatchAction
- type PreMatchResult
- type RDRCStore
- type Router
- type Rule
- type RuleAction
- type RuleSet
- type RuleSetMetadata
- type RuleSetUpdateCallback
- type SSMTracker
- type SavedBinary
- type SecurityPolicy
- type Service
- type ServiceManager
- type ServiceRegistry
- type ShellSession
- type SimpleLifecycle
- type StartStage
- type SystemProxyStatus
- type TCPInjectableInbound
- type TailscaleEndpoint
- type TailscaleEndpointStatus
- type TailscalePeer
- type TailscalePingResult
- type TailscaleUserGroup
- type TimeService
- type UDPInjectableInbound
- type URLTestGroup
- type URLTestHistory
- type USBIPDynamicServer
- type UpstreamHandlerAdapter
- func NewRouteContextHandler(router ConnectionRouterEx) UpstreamHandlerAdapter
- func NewRouteHandler(metadata InboundContext, router ConnectionRouterEx) UpstreamHandlerAdapter
- func NewUpstreamContextHandler(connectionHandler ConnectionHandlerFunc, ...) UpstreamHandlerAdapter
- func NewUpstreamHandler(metadata InboundContext, connectionHandler ConnectionHandlerFunc, ...) UpstreamHandlerAdapter
- type V2RayClientTransport
- type V2RayServer
- type V2RayServerTransport
- type V2RayServerTransportHandler
- type WIFIState
Constants ¶
View Source
const ( OpenConnectStateConnecting = "connecting" OpenConnectStateAuthPending = "auth-pending" OpenConnectStateConnected = "connected" OpenConnectStateError = "error" )
View Source
const ( OpenVPNStateConnecting = "connecting" OpenVPNStateAuthPending = "auth-pending" OpenVPNStateConnected = "connected" OpenVPNStateError = "error" )
Variables ¶
View Source
var ListStartStages = []StartStage{ StartStateInitialize, StartStateStart, StartStatePostStart, StartStateStarted, }
Functions ¶
func IsFinalAction ¶ added in v1.11.0
func IsFinalAction(action RuleAction) bool
func LegacyStart ¶ added in v1.11.0
func LegacyStart(starter any, stage StartStage) error
func LogElapsed ¶ added in v1.13.9
func LogElapsed(logger log.ContextLogger, description ...any) func()
func NormalizeWIFIBSSID ¶ added in v1.13.9
func OutboundTag ¶
func RootPoolFromContext ¶ added in v1.11.10
func Start ¶ added in v1.11.0
func Start(logger log.ContextLogger, stage StartStage, services ...Lifecycle) error
func StartNamed ¶ added in v1.11.0
func StartNamed(logger log.ContextLogger, stage StartStage, services []LifecycleService) error
func UpstreamMetadata
deprecated
func UpstreamMetadata(metadata InboundContext) M.Metadata
Deprecated: removed
func WithContext ¶
func WithContext(ctx context.Context, inboundContext *InboundContext) context.Context
Types ¶
type ACMECertificateProvider ¶
type ACMECertificateProvider interface {
CertificateProvider
GetACMENextProtos() []string
}
type BridgeOptions ¶
type BridgeSession ¶
type CacheFile ¶ added in v1.8.0
type CacheFile interface {
LifecycleService
CacheID() string
StoreFakeIP() bool
FakeIPStorage
StoreRDRC() bool
RDRCStore
StoreDNS() bool
DNSCacheStore
SetDisableExpire(disableExpire bool)
SetOptimisticTimeout(timeout time.Duration)
LoadMode() string
StoreMode(mode string) error
LoadSelected(group string) string
StoreSelected(group string, selected string) error
LoadGroupExpand(group string) (isExpand bool, loaded bool)
StoreGroupExpand(group string, expand bool) error
LoadRuleSet(tag string) *SavedBinary
SaveRuleSet(tag string, set *SavedBinary) error
}
type CertificateProvider ¶
type CertificateProvider interface {
GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
}
type CertificateProviderManager ¶
type CertificateProviderManager interface {
Lifecycle
CertificateProviders() []CertificateProviderService
Get(tag string) (CertificateProviderService, bool)
Remove(tag string) error
Create(ctx context.Context, logger log.ContextLogger, tag string, providerType string, options any) error
}
type CertificateProviderRegistry ¶
type CertificateProviderRegistry interface {
option.CertificateProviderOptionsRegistry
Create(ctx context.Context, logger log.ContextLogger, tag string, providerType string, options any) (CertificateProviderService, error)
}
type CertificateProviderService ¶
type CertificateProviderService interface {
Lifecycle
Type() string
Tag() string
CertificateProvider
}
type CertificateStore ¶ added in v1.11.10
type CertificateStore interface {
LifecycleService
Pool() *x509.CertPool
ExclusiveAnchors() bool
}
type ClashServer ¶
type ClashServer interface {
LifecycleService
Mode() string
ModeList() []string
SetMode(mode string)
AddModeUpdateHook(hook *observable.Subscriber[struct{}])
}
type ConnectionHandler ¶
type ConnectionHandler interface {
NewConnection(ctx context.Context, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
}
type ConnectionHandlerFunc ¶
type ConnectionHandlerFunc = func(ctx context.Context, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
type ConnectionManager ¶ added in v1.11.0
type ConnectionManager interface {
Lifecycle
Count() int
CloseAll()
TrackConn(conn net.Conn) net.Conn
TrackPacketConn(conn net.PacketConn) net.PacketConn
NewConnection(ctx context.Context, this N.Dialer, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
NewPacketConnection(ctx context.Context, this N.Dialer, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
}
type ConnectionOwner ¶ added in v1.13.0
type ConnectionRouter
deprecated
added in
v1.7.0
type ConnectionRouter interface {
RouteConnection(ctx context.Context, conn net.Conn, metadata InboundContext) error
RoutePacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
}
Deprecated: Use ConnectionRouterEx instead.
type ConnectionRouterEx ¶ added in v1.11.0
type ConnectionRouterEx interface {
ConnectionRouter
RouteConnectionEx(ctx context.Context, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
RoutePacketConnectionEx(ctx context.Context, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
}
type ConnectionTracker ¶ added in v1.11.0
type ConnectionTracker interface {
RoutedConnection(ctx context.Context, conn net.Conn, metadata InboundContext, matchedRule Rule, matchOutbound Outbound) net.Conn
RoutedPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext, matchedRule Rule, matchOutbound Outbound) N.PacketConn
RoutedFlow(ctx context.Context, metadata InboundContext, matchedRule Rule, matchOutbound Outbound) tun.FlowTracker
}
type DNSCacheStore ¶
type DNSCacheStore interface {
LoadDNSCache(transportName string, qName string, qType uint16) (rawMessage []byte, expireAt time.Time, loaded bool)
SaveDNSCache(transportName string, qName string, qType uint16, rawMessage []byte, expireAt time.Time) error
SaveDNSCacheAsync(transportName string, qName string, qType uint16, rawMessage []byte, expireAt time.Time, logger logger.Logger)
ClearDNSCache() error
}
type DNSClient ¶ added in v1.11.10
type DNSClient interface {
Start()
Exchange(ctx context.Context, transport DNSTransport, message *dns.Msg, options DNSQueryOptions, responseChecker func(response *dns.Msg) bool) (*dns.Msg, error)
ExchangeAsync(ctx context.Context, transport DNSTransport, message *dns.Msg, options DNSQueryOptions, responseChecker func(response *dns.Msg) bool, callback func(response *dns.Msg, err error))
Lookup(ctx context.Context, transport DNSTransport, domain string, options DNSQueryOptions, responseChecker func(response *dns.Msg) bool) ([]netip.Addr, error)
ClearCache()
}
type DNSQueryOptions ¶ added in v1.11.10
type DNSQueryOptions struct {
Transport DNSTransport
Strategy C.DomainStrategy
LookupStrategy C.DomainStrategy
DisableCache bool
DisableOptimisticCache bool
RewriteTTL *uint32
Timeout time.Duration
ClientSubnet netip.Prefix
}
func DNSQueryOptionsFrom ¶ added in v1.12.0
func DNSQueryOptionsFrom(ctx context.Context, options *option.DomainResolveOptions) (DNSQueryOptions, error)
type DNSRouter ¶ added in v1.11.10
type DNSRouter interface {
Lifecycle
Exchange(ctx context.Context, message *dns.Msg, options DNSQueryOptions) (*dns.Msg, error)
ExchangeAsync(ctx context.Context, message *dns.Msg, options DNSQueryOptions, callback func(response *dns.Msg, err error))
Lookup(ctx context.Context, domain string, options DNSQueryOptions) ([]netip.Addr, error)
ClearCache()
LookupReverseMapping(ip netip.Addr) (string, bool)
ResetNetwork()
}
type DNSRuleSetUpdateValidator ¶
type DNSRuleSetUpdateValidator interface {
ValidateRuleSetMetadataUpdate(tag string, metadata RuleSetMetadata) error
}
type DNSTransport ¶ added in v1.11.10
type DNSTransport interface {
Lifecycle
Type() string
Tag() string
Dependencies() []string
// Reset closes the transport's existing connections so later requests use fresh connections.
// Exchanges that are currently using those connections may fail.
Reset()
Exchange(ctx context.Context, message *dns.Msg) (*dns.Msg, error)
ExchangeAsync(ctx context.Context, message *dns.Msg, callback func(response *dns.Msg, err error))
}
type DNSTransportManager ¶ added in v1.11.10
type DNSTransportManager interface {
Lifecycle
Transports() []DNSTransport
Transport(tag string) (DNSTransport, bool)
Default() DNSTransport
FakeIP() FakeIPTransport
Remove(tag string) error
Create(ctx context.Context, logger log.ContextLogger, tag string, outboundType string, options any) error
}
type DNSTransportRegistry ¶ added in v1.11.10
type DNSTransportRegistry interface {
option.DNSTransportOptionsRegistry
CreateDNSTransport(ctx context.Context, logger log.ContextLogger, tag string, transportType string, options any) (DNSTransport, error)
}
type DNSTransportWithPreferredDomain ¶
type DNSTransportWithPreferredDomain interface {
DNSTransport
PreferredDomain(domain string) bool
}
type EndpointManager ¶ added in v1.11.0
type EndpointRegistry ¶ added in v1.11.0
type FakeIPMetadata ¶ added in v1.3.0
type FakeIPMetadata struct {
Inet4Range netip.Prefix
Inet6Range netip.Prefix
Inet4Current netip.Addr
Inet6Current netip.Addr
}
func (*FakeIPMetadata) MarshalBinary ¶ added in v1.3.0
func (m *FakeIPMetadata) MarshalBinary() (data []byte, err error)
func (*FakeIPMetadata) UnmarshalBinary ¶ added in v1.3.0
func (m *FakeIPMetadata) UnmarshalBinary(data []byte) error
type FakeIPStorage ¶ added in v1.3.0
type FakeIPStorage interface {
FakeIPMetadata() *FakeIPMetadata
FakeIPSaveMetadata(metadata *FakeIPMetadata) error
FakeIPSaveMetadataAsync(metadata *FakeIPMetadata)
FakeIPStore(address netip.Addr, domain string) error
FakeIPStoreAsync(address netip.Addr, domain string, logger logger.Logger)
FakeIPLoad(address netip.Addr) (string, bool)
FakeIPLoadDomain(domain string, isIPv6 bool) (netip.Addr, bool)
FakeIPReset() error
}
type FakeIPStore ¶ added in v1.3.0
type FakeIPTransport ¶ added in v1.3.0
type FakeIPTransport interface {
DNSTransport
Store() FakeIPStore
}
type FindConnectionOwnerRequest ¶ added in v1.13.0
type FlowOutbound ¶
type FlowOutbound interface {
Outbound
tun.Port
PreMatchFlow(network string, destination netip.Addr) PreMatchAction
}
type HTTPClientManager ¶
type HTTPClientManager interface {
ResolveTransport(ctx context.Context, logger logger.ContextLogger, options option.HTTPClientOptions) (HTTPTransport, error)
DefaultTransport() HTTPTransport
ResetNetwork()
}
type HTTPStartContext ¶ added in v1.10.2
type HTTPStartContext struct {
// contains filtered or unexported fields
}
func NewHTTPStartContext ¶ added in v1.10.2
func NewHTTPStartContext() *HTTPStartContext
func (*HTTPStartContext) Close ¶ added in v1.10.2
func (c *HTTPStartContext) Close()
func (*HTTPStartContext) Register ¶
func (c *HTTPStartContext) Register(transport HTTPTransport)
type HTTPTransport ¶
type HTTPTransport interface {
http.RoundTripper
CloseIdleConnections()
Reset()
}
type HeadlessRule ¶ added in v1.8.0
type HeadlessRule interface {
Match(metadata *InboundContext) bool
String() string
}
type InboundContext ¶
type InboundContext struct {
Inbound string
InboundType string
IPVersion uint8
Network string
Source M.Socksaddr
Destination M.Socksaddr
User string
Outbound string
Protocol string
Domain string
Client string
SniffContext any
SnifferNames []string
SniffError error
// Deprecated: implement in rule action
InboundDetour string
LastInbound string
OriginDestination M.Socksaddr
RouteOriginalDestination M.Socksaddr
UDPDisableDomainUnmapping bool
UDPConnect bool
UDPTimeout time.Duration
TLSFragment bool
TLSFragmentFallbackDelay time.Duration
TLSRecordFragment bool
TLSSpoof string
TLSSpoofMethod tlsspoof.Method
NetworkStrategy *C.NetworkStrategy
NetworkType []C.InterfaceType
FallbackNetworkType []C.InterfaceType
FallbackDelay time.Duration
DestinationAddresses []netip.Addr
DNSResponse *dns.Msg
NamedDNSResponses map[string]*dns.Msg
DestinationAddressMatchFromResponse bool
SourceGeoIPCode string
GeoIPCode string
ProcessInfo *ConnectionOwner
SourceMACAddress net.HardwareAddr
SourceHostname string
QueryType uint16
FakeIP bool
PreMatch bool
IPCIDRMatchSource bool
IPCIDRAcceptEmpty bool
SourceAddressMatch bool
SourcePortMatch bool
DestinationAddressMatch bool
DestinationPortMatch bool
DidMatch bool
IgnoreDestinationIPCIDRMatch bool
}
func ContextFrom ¶
func ContextFrom(ctx context.Context) *InboundContext
func ExtendContext ¶ added in v1.5.5
func ExtendContext(ctx context.Context) (context.Context, *InboundContext)
func (*InboundContext) DNSResponseAddressesForMatch ¶
func (c *InboundContext) DNSResponseAddressesForMatch() []netip.Addr
func (*InboundContext) ResetRuleCache ¶ added in v1.8.0
func (c *InboundContext) ResetRuleCache()
func (*InboundContext) ResetRuleMatchCache ¶ added in v1.13.4
func (c *InboundContext) ResetRuleMatchCache()
type InboundManager ¶ added in v1.11.0
type InboundRegistry ¶ added in v1.11.0
type InterfaceUpdateListener ¶ added in v1.1.0
type InterfaceUpdateListener interface {
InterfaceUpdated()
}
type LegacyConnectionHandlerFunc ¶
type LegacyConnectionHandlerFunc = func(ctx context.Context, conn net.Conn, metadata InboundContext) error
Deprecated
type LegacyPacketConnectionHandlerFunc ¶
type LegacyPacketConnectionHandlerFunc = func(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
Deprecated
type LegacyUpstreamHandlerAdapter ¶
type LegacyUpstreamHandlerAdapter interface {
N.TCPConnectionHandler
N.UDPConnectionHandler
E.Handler
}
Deprecated
func NewLegacyRouteContextHandler
deprecated
func NewLegacyRouteContextHandler( router ConnectionRouter, logger logger.ContextLogger, ) LegacyUpstreamHandlerAdapter
Deprecated: Use ConnectionRouterEx instead.
func NewLegacyRouteHandler
deprecated
func NewLegacyRouteHandler( metadata InboundContext, router ConnectionRouter, logger logger.ContextLogger, ) LegacyUpstreamHandlerAdapter
Deprecated: Use ConnectionRouterEx instead.
func NewLegacyUpstreamContextHandler
deprecated
func NewLegacyUpstreamContextHandler( connectionHandler LegacyConnectionHandlerFunc, packetHandler LegacyPacketConnectionHandlerFunc, errorHandler E.Handler, ) LegacyUpstreamHandlerAdapter
Deprecated: Use NewUpstreamContextHandler instead.
func NewLegacyUpstreamHandler ¶
func NewLegacyUpstreamHandler( metadata InboundContext, connectionHandler LegacyConnectionHandlerFunc, packetHandler LegacyPacketConnectionHandlerFunc, errorHandler E.Handler, ) LegacyUpstreamHandlerAdapter
Deprecated
type Lifecycle ¶ added in v1.11.0
type Lifecycle interface {
Start(stage StartStage) error
Close() error
}
type LifecycleService ¶ added in v1.11.0
func NewLifecycleService ¶ added in v1.11.0
func NewLifecycleService(service SimpleLifecycle, name string) LifecycleService
type ManagedSSMServer ¶ added in v1.12.0
type ManagedSSMServer interface {
Inbound
SetTracker(tracker SSMTracker)
UpdateUsers(users []string, uPSKs []string) error
}
type NeighborEntry ¶
type NeighborEntry struct {
Address netip.Addr
MACAddress net.HardwareAddr
Hostname string
}
type NeighborResolver ¶
type NeighborUpdateListener ¶
type NeighborUpdateListener interface {
UpdateNeighborTable(entries []NeighborEntry)
}
type NetworkInterface ¶ added in v1.11.0
type NetworkManager ¶ added in v1.11.0
type NetworkManager interface {
Lifecycle
Initialize(ruleSets []RuleSet)
InterfaceFinder() control.InterfaceFinder
UpdateInterfaces() error
DefaultNetworkInterface() *NetworkInterface
NetworkInterfaces() []NetworkInterface
AutoDetectInterface() bool
AutoDetectInterfaceFunc() control.Func
ProtectFunc() control.Func
DefaultOptions() NetworkOptions
RegisterAutoRedirectOutputMark(mark uint32) error
AutoRedirectOutputMark() uint32
AutoRedirectOutputMarkFunc() control.Func
NetworkMonitor() tun.NetworkUpdateMonitor
InterfaceMonitor() tun.DefaultInterfaceMonitor
PackageManager() tun.PackageManager
NeedWIFIState() bool
WIFIState() WIFIState
UpdateWIFIState()
ResetNetwork()
}
type NetworkNamespaceManager ¶
type NetworkOptions ¶ added in v1.11.0
type NetworkOptions struct {
BindInterface string
RoutingMark uint32
DomainResolver string
DomainResolveOptions DNSQueryOptions
NetworkStrategy *C.NetworkStrategy
NetworkType []C.InterfaceType
FallbackNetworkType []C.InterfaceType
FallbackDelay time.Duration
}
type Notification ¶ added in v1.13.0
type OOBPacketHandler ¶
type OpenConnectAuthChallenge ¶
type OpenConnectAuthChallenge struct {
ID string
Banner string
Message string
Error string
Form *OpenConnectAuthForm
Browser *OpenConnectBrowserRequest
}
type OpenConnectAuthForm ¶
type OpenConnectAuthForm struct {
Fields []OpenConnectAuthFormField
}
type OpenConnectAuthResponse ¶
type OpenConnectAuthResponse struct {
Form *OpenConnectAuthFormResponse
Browser *OpenConnectBrowserResult
}
type OpenConnectBrowserResult ¶
type OpenConnectBrowserResult struct {
FinalURL string
Cookies []OpenConnectBrowserCookie
Headers []OpenConnectBrowserHeader
}
type OpenConnectEndpoint ¶
type OpenConnectEndpoint interface {
Endpoint
OpenConnectStatus() OpenConnectStatus
StatusUpdated() <-chan struct{}
CompleteAuthChallenge(challengeID string, response OpenConnectAuthResponse) error
CancelAuthChallenge(challengeID string) error
}
type OpenConnectStatus ¶
type OpenConnectStatus struct {
State string
AuthChallenge *OpenConnectAuthChallenge
Error string
TunnelInfo *OpenConnectTunnelInfo
}
type OpenConnectTunnelInfo ¶
type OpenVPNChallenge ¶
type OpenVPNEndpoint ¶
type OpenVPNEndpoint interface {
Endpoint
OpenVPNStatus() OpenVPNStatus
StatusUpdated() <-chan struct{}
CompleteChallenge(challengeID string, response OpenVPNChallengeResponse) error
CancelChallenge(challengeID string) error
}
type OpenVPNStatus ¶
type OpenVPNStatus struct {
State string
Challenge *OpenVPNChallenge
Error string
TunnelInfo *OpenVPNTunnelInfo
}
type OpenVPNTunnelInfo ¶
type OutboundGroup ¶
type OutboundManager ¶ added in v1.11.0
type OutboundRegistry ¶ added in v1.11.0
type OutboundWithMultiplex ¶ added in v1.13.15
type OutboundWithPreferredRoutes ¶ added in v1.13.0
type OutboundWithPreferredRoutes interface {
Outbound
PreferredDomain(metadata *InboundContext, domain string) bool
PreferredAddress(metadata *InboundContext, address netip.Addr) bool
}
type PacketBatchHandler ¶
type PacketConnectionHandler ¶
type PacketConnectionHandler interface {
NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
}
type PacketConnectionHandlerFunc ¶
type PacketConnectionHandlerFunc = func(ctx context.Context, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
type PacketHandler ¶
type PlatformInterface ¶ added in v1.13.0
type PlatformInterface interface {
Initialize(networkManager NetworkManager) error
UsePlatformAutoDetectInterfaceControl() bool
AutoDetectInterfaceControl(fd int) error
UsePlatformInterface() bool
OpenInterface(options *tun.Options, platformOptions option.TunPlatformOptions) (tun.Tun, error)
ProcessPlatformOptions(options option.TunPlatformOptions) error
UsePlatformDefaultInterfaceMonitor() bool
CreateDefaultInterfaceMonitor(logger logger.Logger) tun.DefaultInterfaceMonitor
UsePlatformNetworkInterfaces() bool
NetworkInterfaces() ([]NetworkInterface, error)
UnderNetworkExtension() bool
NetworkExtensionIncludeAllNetworks() bool
ClearDNSCache()
RequestPermissionForWIFIState() error
ReadWIFIState() WIFIState
UsePlatformConnectionOwnerFinder() bool
FindConnectionOwner(request *FindConnectionOwnerRequest) (*ConnectionOwner, error)
UsePlatformWIFIMonitor() bool
UsePlatformNotification() bool
SendNotification(notification *Notification) error
MyInterfaceAddress() []netip.Addr
UsePlatformNeighborResolver() bool
StartNeighborMonitor(listener NeighborUpdateListener) error
CloseNeighborMonitor(listener NeighborUpdateListener) error
UsePlatformShell() bool
CheckPlatformShell() error
OpenShellSession(user *PlatformUser, command string, env []string, term string, rows int32, cols int32) (ShellSession, error)
LookupUser(username string) (*PlatformUser, error)
LookupSFTPServer() (string, error)
ReadSystemSSHHostKey() ([]byte, error)
TailscaleHostname() string
UsePlatformBridge() bool
CreateBridge(options BridgeOptions) (BridgeSession, error)
}
type PlatformUser ¶
type PreMatchAction ¶
type PreMatchAction uint8
const ( PreMatchContinue PreMatchAction = iota PreMatchFlow PreMatchReject PreMatchDrop PreMatchBypass PreMatchHijackDNS )
type PreMatchResult ¶
type Router ¶
type Router interface {
Lifecycle
ConnectionRouter
PreMatch(metadata InboundContext, firstPacket []byte) PreMatchResult
HijackDNSPacket(ctx context.Context, payload []byte, writer N.PacketWriter, metadata InboundContext)
ConnectionRouterEx
RuleSet(tag string) (RuleSet, bool)
Rules() []Rule
NeedFindProcess() bool
NeedFindNeighbor() bool
NeighborResolver() NeighborResolver
AppendTracker(tracker ConnectionTracker)
ResetNetwork()
}
type Rule ¶
type Rule interface {
HeadlessRule
SimpleLifecycle
Type() string
Action() RuleAction
}
type RuleAction ¶ added in v1.11.0
type RuleSet ¶ added in v1.8.0
type RuleSet interface {
Name() string
StartContext(ctx context.Context, startContext *HTTPStartContext) error
Metadata() RuleSetMetadata
ExtractIPSet() []*netipx.IPSet
IncRef()
DecRef()
Cleanup()
RegisterCallback(callback RuleSetUpdateCallback) *list.Element[RuleSetUpdateCallback]
UnregisterCallback(element *list.Element[RuleSetUpdateCallback])
Close() error
HeadlessRule
}
type RuleSetMetadata ¶ added in v1.8.0
type RuleSetMetadata struct {
ContainsProcessRule bool
ContainsWIFIRule bool
ContainsIPCIDRRule bool
ContainsDNSQueryTypeRule bool
// ContainsNonIPCIDRRule signals that the rule-set carries at least one sub-rule
// with a predicate other than destination ip_cidr / ip_set, so it can contribute
// to DNS pre-response matching. A rule-set where this is false and
// ContainsIPCIDRRule is true is "pure-IP" and matches nothing before a DNS
// response is available.
ContainsNonIPCIDRRule bool
}
ip_version is not a headless-rule item, so ContainsIPVersionRule is intentionally absent.
type RuleSetUpdateCallback ¶ added in v1.10.0
type RuleSetUpdateCallback func(it RuleSet)
type SSMTracker ¶ added in v1.12.0
type SSMTracker interface {
TrackConnection(conn net.Conn, metadata InboundContext) net.Conn
TrackPacketConnection(conn N.PacketConn, metadata InboundContext) N.PacketConn
}
type SavedBinary ¶ added in v1.11.1
func (*SavedBinary) MarshalBinary ¶ added in v1.11.1
func (s *SavedBinary) MarshalBinary() ([]byte, error)
func (*SavedBinary) UnmarshalBinary ¶ added in v1.11.1
func (s *SavedBinary) UnmarshalBinary(data []byte) error
type SecurityPolicy ¶
type ServiceManager ¶ added in v1.12.0
type ServiceRegistry ¶ added in v1.12.0
type ShellSession ¶
type SimpleLifecycle ¶ added in v1.12.0
type StartStage ¶ added in v1.11.0
type StartStage uint8
const ( StartStateInitialize StartStage = iota StartStateStart StartStatePostStart StartStateStarted )
func (StartStage) String ¶ added in v1.11.0
func (s StartStage) String() string
type SystemProxyStatus ¶ added in v1.13.0
type TCPInjectableInbound ¶ added in v1.11.0
type TCPInjectableInbound interface {
Inbound
ConnectionHandler
}
type TailscaleEndpoint ¶
type TailscaleEndpoint interface {
SubscribeTailscaleStatus(ctx context.Context, fn func(*TailscaleEndpointStatus)) error
StartTailscalePing(ctx context.Context, peerIP string, fn func(*TailscalePingResult)) error
SetTailscaleExitNode(ctx context.Context, stableID string) error
Logout(ctx context.Context) error
}
type TailscaleEndpointStatus ¶
type TailscaleEndpointStatus struct {
BackendState string
AuthURL string
NetworkName string
MagicDNSSuffix string
Self *TailscalePeer
ExitNode *TailscalePeer
UserGroups []*TailscaleUserGroup
KeyAuth bool
}
type TailscalePeer ¶
type TailscalePingResult ¶
type TailscaleUserGroup ¶
type TailscaleUserGroup struct {
UserID int64
LoginName string
DisplayName string
ProfilePicURL string
Peers []*TailscalePeer
}
type TimeService ¶ added in v1.2.0
type TimeService interface {
SimpleLifecycle
TimeFunc() func() time.Time
}
type UDPInjectableInbound ¶ added in v1.11.0
type UDPInjectableInbound interface {
Inbound
PacketConnectionHandler
}
type URLTestGroup ¶ added in v1.3.0
type URLTestHistory ¶ added in v1.11.10
type USBIPDynamicServer ¶
type USBIPDynamicServer interface {
// contains filtered or unexported methods
}
type UpstreamHandlerAdapter ¶
type UpstreamHandlerAdapter interface {
N.TCPConnectionHandlerEx
N.UDPConnectionHandlerEx
}
func NewRouteContextHandler ¶ added in v1.7.0
func NewRouteContextHandler( router ConnectionRouterEx, ) UpstreamHandlerAdapter
func NewRouteHandler ¶ added in v1.7.0
func NewRouteHandler( metadata InboundContext, router ConnectionRouterEx, ) UpstreamHandlerAdapter
func NewUpstreamContextHandler ¶
func NewUpstreamContextHandler( connectionHandler ConnectionHandlerFunc, packetHandler PacketConnectionHandlerFunc, ) UpstreamHandlerAdapter
func NewUpstreamHandler ¶
func NewUpstreamHandler( metadata InboundContext, connectionHandler ConnectionHandlerFunc, packetHandler PacketConnectionHandlerFunc, ) UpstreamHandlerAdapter
type V2RayClientTransport ¶ added in v1.0.1
type V2RayServer ¶ added in v1.1.0
type V2RayServer interface {
LifecycleService
StatsService() ConnectionTracker
}
type V2RayServerTransport ¶ added in v1.0.1
type V2RayServerTransportHandler ¶ added in v1.2.0
type V2RayServerTransportHandler interface {
N.TCPConnectionHandlerEx
}
Source Files
¶
- certificate.go
- certificate_provider.go
- connections.go
- dns.go
- endpoint.go
- experimental.go
- fakeip.go
- fakeip_metadata.go
- handler.go
- http.go
- inbound.go
- lifecycle.go
- lifecycle_legacy.go
- neighbor.go
- netns.go
- network.go
- openconnect.go
- openvpn.go
- outbound.go
- platform.go
- prestart.go
- router.go
- rule.go
- security.go
- service.go
- ssm.go
- tailscale.go
- time.go
- upstream.go
- upstream_legacy.go
- usbip_stub.go
- v2ray.go
Click to show internal directories.
Click to hide internal directories.