Documentation
¶
Index ¶
- Variables
- 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)
- 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 ¶
This section is empty.
Variables ¶
View Source
var ErrIpv6NotSupported = errors.New("ipv6 not supported")
Functions ¶
This section is empty.
Types ¶
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 NewHandlerWithSupport6Info ¶ added in v1.0.7
func NewHandlerWithSupport6Info(outbound i.Outbound, support6 bool) *HandlerWithSupport6Info
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 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
Interval atomic.Value
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.