Documentation ¶
Index ¶
- type AddrEx
- type DirectOutboundMode
- type OutboundEntry
- type PluggableOutbound
- func NewACLEngineFromFile(filename string, outbounds []OutboundEntry, geoLoader acl.GeoLoader) (PluggableOutbound, error)
- func NewACLEngineFromString(rules string, outbounds []OutboundEntry, geoLoader acl.GeoLoader) (PluggableOutbound, error)
- func NewDirectOutboundBindToDevice(mode DirectOutboundMode, deviceName string) (PluggableOutbound, error)
- func NewDirectOutboundBindToIPs(mode DirectOutboundMode, bindIP4, bindIP6 net.IP) (PluggableOutbound, error)
- func NewDirectOutboundSimple(mode DirectOutboundMode) PluggableOutbound
- func NewDoHResolver(host string, timeout time.Duration, sni string, insecure bool, ...) PluggableOutbound
- func NewHTTPOutbound(proxyURL string, insecure bool) (PluggableOutbound, error)
- func NewSOCKS5Outbound(addr, username, password string) PluggableOutbound
- func NewStandardResolverTCP(addr string, timeout time.Duration, next PluggableOutbound) PluggableOutbound
- func NewStandardResolverTLS(addr string, timeout time.Duration, sni string, insecure bool, ...) PluggableOutbound
- func NewStandardResolverUDP(addr string, timeout time.Duration, next PluggableOutbound) PluggableOutbound
- func NewSystemResolver(next PluggableOutbound) PluggableOutbound
- type PluggableOutboundAdapter
- type ResolveInfo
- type UDPConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddrEx ¶
type AddrEx struct { Host string // String representation of the host, can be an IP or a domain name Port uint16 ResolveInfo *ResolveInfo // Only set if there's a resolver in the pipeline }
AddrEx keeps both the original string representation of the address and the resolved IP addresses from the resolver, if any. The actual outbound implementations can choose to use either the string representation or the resolved IP addresses, depending on their capabilities. A SOCKS5 outbound, for example, should prefer the string representation because SOCKS5 protocol supports sending the hostname to the proxy server and let the proxy server do the DNS resolution.
type DirectOutboundMode ¶
type DirectOutboundMode int
const ( DirectOutboundModeAuto DirectOutboundMode = iota // Dual-stack "happy eyeballs"-like mode DirectOutboundMode64 // Use IPv6 address when available, otherwise IPv4 DirectOutboundMode46 // Use IPv4 address when available, otherwise IPv6 DirectOutboundMode6 // Use IPv6 only, fail if not available DirectOutboundMode4 // Use IPv4 only, fail if not available )
type OutboundEntry ¶
type OutboundEntry struct { Name string Outbound PluggableOutbound }
type PluggableOutbound ¶
type PluggableOutbound interface { TCP(reqAddr *AddrEx) (net.Conn, error) UDP(reqAddr *AddrEx) (UDPConn, error) }
PluggableOutbound differs from the built-in Outbound interface from Hysteria core in that it uses an AddrEx struct for addresses instead of a string. Because of this difference, we need a special PluggableOutboundAdapter to convert between the two for use in Hysteria core config.
func NewACLEngineFromFile ¶
func NewACLEngineFromFile(filename string, outbounds []OutboundEntry, geoLoader acl.GeoLoader) (PluggableOutbound, error)
func NewACLEngineFromString ¶
func NewACLEngineFromString(rules string, outbounds []OutboundEntry, geoLoader acl.GeoLoader) (PluggableOutbound, error)
func NewDirectOutboundBindToDevice ¶
func NewDirectOutboundBindToDevice(mode DirectOutboundMode, deviceName string) (PluggableOutbound, error)
NewDirectOutboundBindToDevice creates a new directOutbound with the given mode, and binds to the given device. Only works on Linux.
func NewDirectOutboundBindToIPs ¶
func NewDirectOutboundBindToIPs(mode DirectOutboundMode, bindIP4, bindIP6 net.IP) (PluggableOutbound, error)
NewDirectOutboundBindToIPs creates a new directOutbound with the given mode, and binds to the given IPv4 and IPv6 addresses. Either or both of the addresses can be nil, in which case the directOutbound will not bind to a specific address for that family.
func NewDirectOutboundSimple ¶
func NewDirectOutboundSimple(mode DirectOutboundMode) PluggableOutbound
NewDirectOutboundSimple creates a new directOutbound with the given mode, without binding to a specific device. Works on all platforms.
func NewDoHResolver ¶
func NewDoHResolver(host string, timeout time.Duration, sni string, insecure bool, next PluggableOutbound) PluggableOutbound
func NewHTTPOutbound ¶
func NewHTTPOutbound(proxyURL string, insecure bool) (PluggableOutbound, error)
func NewSOCKS5Outbound ¶
func NewSOCKS5Outbound(addr, username, password string) PluggableOutbound
func NewStandardResolverTCP ¶
func NewStandardResolverTCP(addr string, timeout time.Duration, next PluggableOutbound) PluggableOutbound
func NewStandardResolverTLS ¶
func NewStandardResolverTLS(addr string, timeout time.Duration, sni string, insecure bool, next PluggableOutbound) PluggableOutbound
func NewStandardResolverUDP ¶
func NewStandardResolverUDP(addr string, timeout time.Duration, next PluggableOutbound) PluggableOutbound
func NewSystemResolver ¶
func NewSystemResolver(next PluggableOutbound) PluggableOutbound
type PluggableOutboundAdapter ¶
type PluggableOutboundAdapter struct {
PluggableOutbound
}
type ResolveInfo ¶
ResolveInfo contains the resolved IP addresses from the resolver, and any error that occurred during the resolution. Note that there could be no error but also no resolved IP addresses, or there could be an error but also some resolved IP addresses. It's up to the actual outbound implementation to decide how to handle these cases.