Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v0.12.0
type Option func(c *config)
Option 用于配置 TCPForwarder 和 UDPForwarder
func WithErrorHandler ¶ added in v0.12.0
func WithErrorHandler(h ErrorHandler) Option
WithErrorHandler 允许调用方注入异步错误处理回调(必须支持并发调用)
func WithLogger ¶ added in v0.12.0
func WithLogger(l logger.DebugLogger) Option
WithLogger 允许调用方注入 DebugLogger 实现(必须支持并发调用)
type TCPForwarder ¶
type TCPForwarder struct {
// contains filtered or unexported fields
}
TCPForwarder listens on a local TCP address and forwards connections to a target address.
func NewTCPForwarder ¶
func NewTCPForwarder(listenAddr, targetAddr string, opts ...Option) *TCPForwarder
NewTCPForwarder creates a new TCPForwarder.
type UDPForwarder ¶
type UDPForwarder struct {
// contains filtered or unexported fields
}
UDPForwarder listens on a local UDP address and forwards datagrams to a target address.
func NewUDPForwarder ¶
func NewUDPForwarder(listenAddr, targetAddr string, opts ...Option) *UDPForwarder
NewUDPForwarder creates a new UDPForwarder.
Click to show internal directories.
Click to hide internal directories.