Documentation
¶
Index ¶
- Constants
- func CanonicalizeHTTPOriginURL(parsedURL *url.URL) *url.URL
- func IsHTTPServiceScheme(scheme string) bool
- func MatchIngressHost(pattern, hostname string) bool
- func MatchIngressRule(rule CompiledIngressRule, hostname, path string) bool
- func ResolvePolicyDestination(ctx context.Context, destination M.Socksaddr) (netip.Addr, error)
- func ValidateHostname(hostname string, isLast bool) error
- type AccessConfig
- type CompiledIPRule
- type CompiledIngressRule
- type ConfigManager
- type IPRule
- type IPRulePolicy
- type LocalIngressRule
- type OriginRequestConfig
- type RemoteAccessJSON
- type RemoteConfigJSON
- type RemoteIPRuleJSON
- type RemoteIngressRuleJSON
- type RemoteOriginRequestJSON
- type RemoteWarpRoutingJSON
- type ResolvedService
- type ResolvedServiceKind
- type RuntimeConfig
- type UpdateResult
- type WarpRoutingConfig
Constants ¶
View Source
const ( DefaultWarpRoutingConnectTime = 5 * time.Second DefaultWarpRoutingTCPKeepAlive = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func IsHTTPServiceScheme ¶
func MatchIngressHost ¶
func MatchIngressRule ¶
func MatchIngressRule(rule CompiledIngressRule, hostname, path string) bool
func ValidateHostname ¶
Types ¶
type AccessConfig ¶
type CompiledIPRule ¶
type CompiledIPRule struct {
// contains filtered or unexported fields
}
type CompiledIngressRule ¶
type CompiledIngressRule struct {
Hostname string
PunycodeHostname string
Path *regexp.Regexp
Service ResolvedService
}
func CompileIngressRules ¶
func CompileIngressRules(defaultOriginRequest OriginRequestConfig, rawRules []LocalIngressRule) ([]CompiledIngressRule, error)
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
func NewConfigManager ¶
func NewConfigManager() (*ConfigManager, error)
func (*ConfigManager) Apply ¶
func (m *ConfigManager) Apply(version int32, raw []byte) UpdateResult
func (*ConfigManager) CurrentVersion ¶
func (m *ConfigManager) CurrentVersion() int32
func (*ConfigManager) Resolve ¶
func (m *ConfigManager) Resolve(hostname, path string) (ResolvedService, bool)
func (*ConfigManager) Snapshot ¶
func (m *ConfigManager) Snapshot() RuntimeConfig
type IPRulePolicy ¶
type IPRulePolicy struct {
// contains filtered or unexported fields
}
func NewIPRulePolicy ¶
func NewIPRulePolicy(rawRules []IPRule) (*IPRulePolicy, error)
type LocalIngressRule ¶
type LocalIngressRule struct {
Hostname string
Path string
Service string
OriginRequest OriginRequestConfig
}
type OriginRequestConfig ¶
type OriginRequestConfig struct {
ConnectTimeout time.Duration
TLSTimeout time.Duration
TCPKeepAlive time.Duration
NoHappyEyeballs bool
KeepAliveTimeout time.Duration
KeepAliveConnections int
HTTPHostHeader string
OriginServerName string
MatchSNIToHost bool
CAPool string
NoTLSVerify bool
DisableChunkedEncoding bool
BastionMode bool
ProxyAddress string
ProxyPort uint
ProxyType string
IPRules []IPRule
HTTP2Origin bool
Access AccessConfig
}
func DefaultOriginRequestConfig ¶
func DefaultOriginRequestConfig() OriginRequestConfig
func MergeRemoteOriginRequest ¶
func MergeRemoteOriginRequest(base OriginRequestConfig, override RemoteOriginRequestJSON) OriginRequestConfig
type RemoteAccessJSON ¶
type RemoteConfigJSON ¶
type RemoteConfigJSON struct {
OriginRequest RemoteOriginRequestJSON `json:"originRequest"`
Ingress []RemoteIngressRuleJSON `json:"ingress"`
WarpRouting RemoteWarpRoutingJSON `json:"warp-routing"`
}
type RemoteIPRuleJSON ¶
type RemoteIngressRuleJSON ¶
type RemoteIngressRuleJSON struct {
Hostname string `json:"hostname,omitempty"`
Path string `json:"path,omitempty"`
Service string `json:"service"`
OriginRequest RemoteOriginRequestJSON `json:"originRequest,omitempty"`
}
type RemoteOriginRequestJSON ¶
type RemoteOriginRequestJSON struct {
ConnectTimeout int64 `json:"connectTimeout,omitempty"`
TLSTimeout int64 `json:"tlsTimeout,omitempty"`
TCPKeepAlive int64 `json:"tcpKeepAlive,omitempty"`
NoHappyEyeballs *bool `json:"noHappyEyeballs,omitempty"`
KeepAliveTimeout int64 `json:"keepAliveTimeout,omitempty"`
KeepAliveConnections *int `json:"keepAliveConnections,omitempty"`
HTTPHostHeader string `json:"httpHostHeader,omitempty"`
OriginServerName string `json:"originServerName,omitempty"`
MatchSNIToHost *bool `json:"matchSNIToHost,omitempty"`
CAPool string `json:"caPool,omitempty"`
NoTLSVerify *bool `json:"noTLSVerify,omitempty"`
DisableChunkedEncoding *bool `json:"disableChunkedEncoding,omitempty"`
BastionMode *bool `json:"bastionMode,omitempty"`
ProxyAddress string `json:"proxyAddress,omitempty"`
ProxyPort *uint `json:"proxyPort,omitempty"`
ProxyType string `json:"proxyType,omitempty"`
IPRules []RemoteIPRuleJSON `json:"ipRules,omitempty"`
HTTP2Origin *bool `json:"http2Origin,omitempty"`
Access *RemoteAccessJSON `json:"access,omitempty"`
}
type RemoteWarpRoutingJSON ¶
type ResolvedService ¶
type ResolvedService struct {
Kind ResolvedServiceKind
Service string
Destination M.Socksaddr
StreamHasPort bool
BaseURL *url.URL
UnixPath string
StatusCode int
SocksPolicy *IPRulePolicy
OriginRequest OriginRequestConfig
}
func ParseResolvedService ¶
func ParseResolvedService(rawService string, originRequest OriginRequestConfig) (ResolvedService, error)
func (ResolvedService) BuildRequestURL ¶
func (s ResolvedService) BuildRequestURL(requestURL string) (string, error)
func (ResolvedService) RouterControlled ¶
func (s ResolvedService) RouterControlled() bool
type ResolvedServiceKind ¶
type ResolvedServiceKind int
const ( ResolvedServiceHTTP ResolvedServiceKind = iota ResolvedServiceStream ResolvedServiceStatus ResolvedServiceUnix ResolvedServiceUnixTLS ResolvedServiceBastion ResolvedServiceSocksProxy )
type RuntimeConfig ¶
type RuntimeConfig struct {
Ingress []CompiledIngressRule
OriginRequest OriginRequestConfig
WarpRouting WarpRoutingConfig
}
func BuildRemoteRuntimeConfig ¶
func BuildRemoteRuntimeConfig(raw []byte) (RuntimeConfig, error)
func DefaultRuntimeConfig ¶
func DefaultRuntimeConfig() (RuntimeConfig, error)
func (RuntimeConfig) Resolve ¶
func (c RuntimeConfig) Resolve(hostname, path string) (ResolvedService, bool)
type UpdateResult ¶
type WarpRoutingConfig ¶
type WarpRoutingConfig struct {
ConnectTimeout time.Duration
MaxActiveFlows uint64
TCPKeepAlive time.Duration
}
func WarpRoutingFromRemote ¶
func WarpRoutingFromRemote(input RemoteWarpRoutingJSON) WarpRoutingConfig
Click to show internal directories.
Click to hide internal directories.