Documentation
¶
Index ¶
- Constants
- Variables
- func GetAllProxyhandlers(om i.OutboundManager) []i.Outbound
- func NewHandler(config *HandlerConfig) (i.Outbound, error)
- func NewOutHandler(config *Config) (i.Outbound, error)
- type ChainHandler
- type ChainHandlerConfig
- type Config
- type HandlerConfig
- type HandlerObserver
- type HandlerWithStats
- type HandlerWithSupport6Info
- type Manager
- func (m *Manager) AddHandlerObserver(o HandlerObserver)
- func (m *Manager) AddHandlers(handlers ...i.Outbound) error
- func (m *Manager) Close() error
- func (m *Manager) GetAllHandlers() []i.Outbound
- func (m *Manager) GetHandler(tag string) i.Outbound
- func (m *Manager) RemoveHandlerObserver(observer HandlerObserver)
- func (m *Manager) RemoveHandlers(tags []string) error
- func (m *Manager) ReplaceHandlers(handlers ...i.Outbound) error
- func (m *Manager) Start() error
- type OnHandlerChangedFunc
- type OutStats
- type OutboundHandlerStats
- type ProxyHandler
- func (h *ProxyHandler) Close() error
- func (h *ProxyHandler) HandleFlow(ctx context.Context, dst net.Destination, rw buf.ReaderWriter) error
- func (h *ProxyHandler) HandlePacketConn(ctx context.Context, dst net.Destination, rw udp.PacketReaderWriter) error
- func (h *ProxyHandler) Start() error
- func (h *ProxyHandler) Tag() string
- type ProxyHandlerSettings
- type RandomPortSelector
Constants ¶
View Source
const DirectHandlerTag = "direct"
View Source
const DnsHandlerTag = "dns"
Variables ¶
View Source
var ErrIpv6NotSupported = errors.New("ipv6 not supported")
Functions ¶
func GetAllProxyhandlers ¶
func GetAllProxyhandlers(om i.OutboundManager) []i.Outbound
return all handlers except direct and dns
func NewHandler ¶
func NewHandler(config *HandlerConfig) (i.Outbound, error)
Types ¶
type ChainHandler ¶
type ChainHandler struct {
// contains filtered or unexported fields
}
func NewChainHandler ¶
func NewChainHandler(config *ChainHandlerConfig) (*ChainHandler, error)
func (*ChainHandler) HandleFlow ¶
func (c *ChainHandler) HandleFlow(ctx context.Context, dst net.Destination, rw buf.ReaderWriter) error
func (*ChainHandler) HandlePacketConn ¶
func (c *ChainHandler) HandlePacketConn(ctx context.Context, dst net.Destination, p udp.PacketReaderWriter) error
func (*ChainHandler) Tag ¶
func (c *ChainHandler) Tag() string
type ChainHandlerConfig ¶
type ChainHandlerConfig struct {
*configs.ChainHandlerConfig
Policy *policy.Policy
IPResolver i.IPResolver
DF transport.DialerFactory
IPResolverForRequestAddress i.IPResolver
// used to lookup ech config
DnsServer i.ECHResolver
RejectQuic bool
}
type Config ¶
type Config struct {
*configs.OutboundHandlerConfig
DialerFactory transport.DialerFactory
Policy i.TimeoutSetting
// some outbound require it to lookup server addresses
IPResolver i.IPResolver
// some outbounds need it to lookup ips of request addresses
IPResolverForRequestAddress i.IPResolver
//
RejectQuic bool
}
type HandlerConfig ¶
type HandlerConfig struct {
*configs.HandlerConfig
DialerFactory transport.DialerFactory
Policy *policy.Policy
// for node domain
IPResolver i.IPResolver
IPResolverForRequestAddress i.IPResolver
DnsServer i.ECHResolver
RejectQuic bool
}
type HandlerObserver ¶
type HandlerObserver interface {
OnHandlerChanged()
}
type HandlerWithStats ¶
type HandlerWithStats struct {
i.Outbound
Stats *OutboundHandlerStats
}
func (*HandlerWithStats) GetHandlerStats ¶
func (i *HandlerWithStats) GetHandlerStats() *OutboundHandlerStats
type HandlerWithSupport6Info ¶
type HandlerWithSupport6Info struct {
i.Outbound
util.IPv6SupportChangeNotifier
// contains filtered or unexported fields
}
func (*HandlerWithSupport6Info) SetSupport6 ¶
func (h *HandlerWithSupport6Info) SetSupport6(support6 bool)
func (*HandlerWithSupport6Info) Support6 ¶
func (h *HandlerWithSupport6Info) Support6() bool
type Manager ¶
holds all outbound handlers. notify its listeners when a change happens.
func NewManager ¶
func NewManager() *Manager
func (*Manager) AddHandlerObserver ¶
func (m *Manager) AddHandlerObserver(o HandlerObserver)
func (*Manager) GetAllHandlers ¶
func (*Manager) RemoveHandlerObserver ¶
func (m *Manager) RemoveHandlerObserver(observer HandlerObserver)
func (*Manager) RemoveHandlers ¶
func (*Manager) ReplaceHandlers ¶
replace all proxy handlers with new ones
type OnHandlerChangedFunc ¶
type OnHandlerChangedFunc func()
func (OnHandlerChangedFunc) OnHandlerChanged ¶
func (f OnHandlerChangedFunc) OnHandlerChanged()
type OutStats ¶
type OutStats struct {
sync.Mutex
Map map[string]*OutboundHandlerStats
}
func NewOutStats ¶
func NewOutStats() *OutStats
func (*OutStats) CleanOldStats ¶
func (o *OutStats) CleanOldStats()
func (*OutStats) Get ¶
func (o *OutStats) Get(tag string) *OutboundHandlerStats
type OutboundHandlerStats ¶
type OutboundHandlerStats struct {
UpCounter atomic.Uint64
DownCounter atomic.Uint64
Throughput atomic.Uint64
Ping atomic.Uint64
Time atomic.Value
}
func NewHandlerStats ¶
func NewHandlerStats(throughput uint64, ping uint64) *OutboundHandlerStats
func (*OutboundHandlerStats) AddPing ¶
func (s *OutboundHandlerStats) AddPing(v uint64)
func (*OutboundHandlerStats) AddThroughput ¶
func (s *OutboundHandlerStats) AddThroughput(v uint64)
type ProxyHandler ¶
implement outbound.ProxyHandler and transport.Dialer
func NewProxyHandler ¶
func NewProxyHandler(settings ProxyHandlerSettings) *ProxyHandler
func (*ProxyHandler) Close ¶
func (h *ProxyHandler) Close() error
func (*ProxyHandler) HandleFlow ¶
func (h *ProxyHandler) HandleFlow(ctx context.Context, dst net.Destination, rw buf.ReaderWriter) error
func (*ProxyHandler) HandlePacketConn ¶
func (h *ProxyHandler) HandlePacketConn(ctx context.Context, dst net.Destination, rw udp.PacketReaderWriter) error
func (*ProxyHandler) Start ¶
func (h *ProxyHandler) Start() error
func (*ProxyHandler) Tag ¶
func (h *ProxyHandler) Tag() string
type ProxyHandlerSettings ¶
type RandomPortSelector ¶
func NewRandomPortSelector ¶
func NewRandomPortSelector(ranges []*net.PortRange) *RandomPortSelector
func (*RandomPortSelector) SelectPort ¶
func (s *RandomPortSelector) SelectPort() uint16
randomly select one enabled port from the list
Click to show internal directories.
Click to hide internal directories.