Documentation
¶
Index ¶
- Constants
- Variables
- func Accept(l net.Listener, f func(c net.Conn))
- func BuildProxyProtocolHeader(c net.Conn, proxyProtocol int) []byte
- func BuildProxyProtocolHeaderByAddr(clientAddr, targetAddr net.Addr, proxyProtocol int) []byte
- func BuildProxyProtocolV1Header(clientAddr, targetAddr net.Addr) []byte
- func BuildProxyProtocolV2Header(clientAddr, targetAddr net.Addr) []byte
- func CheckFlowLimits(f *file.Flow, label string, now time.Time) error
- func CopyWaitGroup(conn1, conn2 net.Conn, crypt bool, snappy bool, rate *rate.Rate, ...)
- func DialWS(rawConn net.Conn, urlStr, host string, timeout time.Duration) (*websocket.Conn, *http.Response, error)
- func DialWSS(rawConn net.Conn, urlStr, host, sni string, timeout time.Duration) (*websocket.Conn, *http.Response, error)
- func GetConn(conn net.Conn, cpt, snappy bool, rt *rate.Rate, isServer, isLocal bool) io.ReadWriteCloser
- func GetLenBytes(buf []byte) (b []byte, err error)
- func GetRealIP(r *http.Request, header string) string
- func GetTlsConn(c net.Conn, sni string) (net.Conn, error)
- func HandleUdp5(ctx context.Context, serverConn net.Conn, timeout time.Duration)
- func IsTempOrTimeout(err error) bool
- func NewKcpListenerAndProcess(addr string, f func(c net.Conn)) error
- func NewQuicListenerAndProcess(addr string, tlsConfig *tls.Config, quicConfig *quic.Config, ...) error
- func NewTcpListenerAndProcess(addr string, f func(c net.Conn), listener *net.Listener) error
- func NewTimeoutConn(c net.Conn, idle time.Duration) net.Conn
- func NewTimeoutTLSConn(raw net.Conn, cfg *tls.Config, idle, handshakeTimeout time.Duration) (net.Conn, error)
- func NewUdpConnByAddr(addr string) (net.PacketConn, error)
- func NewWSListener(base net.Listener, path, trustedIps, realIpHeader string) net.Listener
- func NewWSSListener(base net.Listener, path string, cert tls.Certificate, ...) net.Listener
- func ParseAddr(addr string) net.Addr
- func ReadACK(c net.Conn, timeout time.Duration) error
- func SetUdpSession(sess *kcp.UDPSession)
- func WrapConn(rwc io.ReadWriteCloser, parent net.Conn) net.Conn
- func WriteACK(c net.Conn, timeout time.Duration) error
- type AddrOverrideConn
- type Conn
- func (s *Conn) BufferWrite(b []byte) (int, error)
- func (s *Conn) Close() error
- func (s *Conn) FlushBuf() error
- func (s *Conn) GetAddStatus() (b bool)
- func (s *Conn) GetConfigInfo() (c *file.Client, err error)
- func (s *Conn) GetHealthInfo() (info string, status bool, err error)
- func (s *Conn) GetHost() (method, address string, rb []byte, err error, r *http.Request)
- func (s *Conn) GetHostInfo() (h *file.Host, err error)
- func (s *Conn) GetLen() (int, error)
- func (s *Conn) GetLinkInfo() (lk *Link, err error)
- func (s *Conn) GetShortContent(l int) (b []byte, err error)
- func (s *Conn) GetShortLenContent() (b []byte, err error)
- func (s *Conn) GetTaskInfo() (t *file.Tunnel, err error)
- func (s *Conn) IsClosed() bool
- func (s *Conn) LocalAddr() net.Addr
- func (s *Conn) OnClose(fn func(*Conn)) *Conn
- func (s *Conn) Read(b []byte) (n int, err error)
- func (s *Conn) ReadFlag() (string, error)
- func (s *Conn) ReadLen(cLen int, buf []byte) (int, error)
- func (s *Conn) RemoteAddr() net.Addr
- func (s *Conn) SendHealthInfo(info, status string) (int, error)
- func (s *Conn) SendInfo(t interface{}, flag string) (int, error)
- func (s *Conn) SetAlive()
- func (s *Conn) SetDeadline(t time.Time) error
- func (s *Conn) SetRb(rbs ...[]byte) *Conn
- func (s *Conn) SetReadDeadline(t time.Time) error
- func (s *Conn) SetReadDeadlineBySecond(t time.Duration)
- func (s *Conn) SetWriteDeadline(t time.Time) error
- func (s *Conn) Write(b []byte) (n int, err error)
- func (s *Conn) WriteAddFail() error
- func (s *Conn) WriteAddOk() error
- func (s *Conn) WriteChan() (int, error)
- func (s *Conn) WriteClose() (int, error)
- func (s *Conn) WriteConfig() (int, error)
- func (s *Conn) WriteLenContent(buf []byte) (err error)
- func (s *Conn) WriteMain() (int, error)
- type FlowConn
- type FramedConn
- func (fc *FramedConn) Close() error
- func (fc *FramedConn) LocalAddr() net.Addr
- func (fc *FramedConn) Read(p []byte) (int, error)
- func (fc *FramedConn) RemoteAddr() net.Addr
- func (fc *FramedConn) SetDeadline(t time.Time) error
- func (fc *FramedConn) SetReadDeadline(t time.Time) error
- func (fc *FramedConn) SetWriteDeadline(t time.Time) error
- func (fc *FramedConn) Write(p []byte) (int, error)
- type LenConn
- type Link
- type OneConnListener
- type Option
- type Options
- type QuicAutoCloseConn
- type QuicStreamConn
- func (q *QuicStreamConn) Close() error
- func (q *QuicStreamConn) GetSession() *quic.Conn
- func (q *QuicStreamConn) LocalAddr() net.Addr
- func (q *QuicStreamConn) Read(p []byte) (int, error)
- func (q *QuicStreamConn) RemoteAddr() net.Addr
- func (q *QuicStreamConn) SetDeadline(t time.Time) error
- func (q *QuicStreamConn) SetReadDeadline(t time.Time) error
- func (q *QuicStreamConn) SetWriteDeadline(t time.Time) error
- func (q *QuicStreamConn) Write(p []byte) (int, error)
- type RWConn
- type Secret
- type SmartUdpConn
- func (s *SmartUdpConn) Close() error
- func (s *SmartUdpConn) LocalAddr() net.Addr
- func (s *SmartUdpConn) ReadFrom(p []byte) (int, net.Addr, error)
- func (s *SmartUdpConn) SetDeadline(t time.Time) error
- func (s *SmartUdpConn) SetReadDeadline(t time.Time) error
- func (s *SmartUdpConn) SetWriteDeadline(t time.Time) error
- func (s *SmartUdpConn) WriteTo(p []byte, addr net.Addr) (int, error)
- type SnappyConn
- type TeeConn
- func (t *TeeConn) Buffered() []byte
- func (t *TeeConn) Close() error
- func (t *TeeConn) ExtractAndReset() []byte
- func (t *TeeConn) LocalAddr() net.Addr
- func (t *TeeConn) Read(p []byte) (n int, err error)
- func (t *TeeConn) Release() (net.Conn, []byte)
- func (t *TeeConn) RemoteAddr() net.Addr
- func (t *TeeConn) ResetBuffer()
- func (t *TeeConn) SetDeadline(deadline time.Time) error
- func (t *TeeConn) SetReadDeadline(deadline time.Time) error
- func (t *TeeConn) SetWriteDeadline(deadline time.Time) error
- func (t *TeeConn) StopAndClean()
- func (t *TeeConn) StopBuffering()
- func (t *TeeConn) Write(p []byte) (n int, err error)
- type TimeoutConn
- type TlsConn
- func (c *TlsConn) Close() error
- func (c *TlsConn) GetRawConn() net.Conn
- func (c *TlsConn) LocalAddr() net.Addr
- func (c *TlsConn) Read(b []byte) (n int, err error)
- func (c *TlsConn) RemoteAddr() net.Addr
- func (c *TlsConn) SetDeadline(t time.Time) error
- func (c *TlsConn) SetReadDeadline(t time.Time) error
- func (c *TlsConn) SetWriteDeadline(t time.Time) error
- func (c *TlsConn) Write(b []byte) (n int, err error)
- type VirtualListener
- func (l *VirtualListener) Accept() (net.Conn, error)
- func (l *VirtualListener) Addr() net.Addr
- func (l *VirtualListener) Close() error
- func (l *VirtualListener) DialVirtual(rAddr string) (net.Conn, error)
- func (l *VirtualListener) ServeVirtual(c net.Conn)
- func (l *VirtualListener) SetAddr(addr net.Addr)
- type WsConn
- func (c *WsConn) Close() error
- func (c *WsConn) LocalAddr() net.Addr
- func (c *WsConn) Read(p []byte) (int, error)
- func (c *WsConn) RemoteAddr() net.Addr
- func (c *WsConn) SetDeadline(t time.Time) error
- func (c *WsConn) SetReadDeadline(t time.Time) error
- func (c *WsConn) SetWriteDeadline(t time.Time) error
- func (c *WsConn) Write(p []byte) (int, error)
Constants ¶
View Source
const MaxFramePayload = 65535
Variables ¶
View Source
var ErrFrameTooLarge = errors.New("framed: frame size exceeds MaxFramePayload")
View Source
var LocalTCPAddr = &net.TCPAddr{IP: net.ParseIP("127.0.0.1")}
Functions ¶
func CheckFlowLimits ¶ added in v0.33.12
func CopyWaitGroup ¶
func CopyWaitGroup(conn1, conn2 net.Conn, crypt bool, snappy bool, rate *rate.Rate, flows []*file.Flow, isServer bool, proxyProtocol int, rb []byte, task *file.Tunnel, isLocal, isFramed bool)
CopyWaitGroup conn1 mux conn
func GetConn ¶
func GetConn(conn net.Conn, cpt, snappy bool, rt *rate.Rate, isServer, isLocal bool) io.ReadWriteCloser
GetConn get crypt or snappy conn
func GetLenBytes ¶
GetLenBytes get the assembled amount data(len 4 and content)
func HandleUdp5 ¶ added in v0.33.12
func IsTempOrTimeout ¶ added in v0.33.12
func NewQuicListenerAndProcess ¶ added in v0.33.12
func NewTimeoutConn ¶ added in v0.33.12
func NewTimeoutTLSConn ¶ added in v0.33.12
func NewUdpConnByAddr ¶ added in v0.33.12
func NewUdpConnByAddr(addr string) (net.PacketConn, error)
func NewWSListener ¶
func NewWSSListener ¶
Types ¶
type AddrOverrideConn ¶ added in v0.33.12
func NewAddrOverrideConn ¶ added in v0.33.12
func NewAddrOverrideConn(base net.Conn, remote, local string) (*AddrOverrideConn, error)
func NewAddrOverrideFromAddr ¶ added in v0.33.12
func NewAddrOverrideFromAddr(base net.Conn, remote, local net.Addr) *AddrOverrideConn
func (*AddrOverrideConn) LocalAddr ¶ added in v0.33.12
func (c *AddrOverrideConn) LocalAddr() net.Addr
func (*AddrOverrideConn) RemoteAddr ¶ added in v0.33.12
func (c *AddrOverrideConn) RemoteAddr() net.Addr
type Conn ¶
func (*Conn) GetAddStatus ¶
GetAddStatus get task or host result of add
func (*Conn) GetConfigInfo ¶
GetConfigInfo get task info
func (*Conn) GetHealthInfo ¶
GetHealthInfo get health info from conn
func (*Conn) GetHostInfo ¶
GetHostInfo get task info
func (*Conn) GetLinkInfo ¶
GetLinkInfo get link info from conn
func (*Conn) GetShortLenContent ¶
func (*Conn) GetTaskInfo ¶
GetTaskInfo get task info
func (*Conn) RemoteAddr ¶
func (*Conn) SendHealthInfo ¶
SendHealthInfo send info for link
func (*Conn) SetReadDeadlineBySecond ¶
SetReadDeadlineBySecond set read deadline
func (*Conn) WriteAddFail ¶
func (*Conn) WriteAddOk ¶
func (*Conn) WriteLenContent ¶
type FlowConn ¶
type FlowConn struct {
*RWConn
// contains filtered or unexported fields
}
func NewFlowConn ¶
func NewFlowConn(conn io.ReadWriteCloser, task, client *file.Flow) *FlowConn
type FramedConn ¶ added in v0.33.12
func WrapFramed ¶ added in v0.33.12
func WrapFramed(c net.Conn) *FramedConn
func (*FramedConn) Close ¶ added in v0.33.12
func (fc *FramedConn) Close() error
func (*FramedConn) LocalAddr ¶ added in v0.33.12
func (fc *FramedConn) LocalAddr() net.Addr
func (*FramedConn) RemoteAddr ¶ added in v0.33.12
func (fc *FramedConn) RemoteAddr() net.Addr
func (*FramedConn) SetDeadline ¶ added in v0.33.12
func (fc *FramedConn) SetDeadline(t time.Time) error
func (*FramedConn) SetReadDeadline ¶ added in v0.33.12
func (fc *FramedConn) SetReadDeadline(t time.Time) error
func (*FramedConn) SetWriteDeadline ¶ added in v0.33.12
func (fc *FramedConn) SetWriteDeadline(t time.Time) error
type LenConn ¶
type LenConn struct {
Len int
// contains filtered or unexported fields
}
func NewLenConn ¶
type Link ¶
type OneConnListener ¶
type OneConnListener struct {
// contains filtered or unexported fields
}
func NewOneConnListener ¶
func NewOneConnListener(c net.Conn) *OneConnListener
func (*OneConnListener) Addr ¶
func (l *OneConnListener) Addr() net.Addr
func (*OneConnListener) Close ¶
func (l *OneConnListener) Close() error
type QuicAutoCloseConn ¶ added in v0.33.12
type QuicAutoCloseConn struct{ *QuicStreamConn }
func NewQuicAutoCloseConn ¶ added in v0.33.12
func NewQuicAutoCloseConn(stream *quic.Stream, sess *quic.Conn) *QuicAutoCloseConn
func (*QuicAutoCloseConn) Close ¶ added in v0.33.12
func (q *QuicAutoCloseConn) Close() error
type QuicStreamConn ¶ added in v0.33.12
type QuicStreamConn struct {
// contains filtered or unexported fields
}
func NewQuicStreamConn ¶ added in v0.33.12
func NewQuicStreamConn(stream *quic.Stream, sess *quic.Conn) *QuicStreamConn
func (*QuicStreamConn) Close ¶ added in v0.33.12
func (q *QuicStreamConn) Close() error
func (*QuicStreamConn) GetSession ¶ added in v0.33.12
func (q *QuicStreamConn) GetSession() *quic.Conn
func (*QuicStreamConn) LocalAddr ¶ added in v0.33.12
func (q *QuicStreamConn) LocalAddr() net.Addr
func (*QuicStreamConn) Read ¶ added in v0.33.12
func (q *QuicStreamConn) Read(p []byte) (int, error)
func (*QuicStreamConn) RemoteAddr ¶ added in v0.33.12
func (q *QuicStreamConn) RemoteAddr() net.Addr
func (*QuicStreamConn) SetDeadline ¶ added in v0.33.12
func (q *QuicStreamConn) SetDeadline(t time.Time) error
func (*QuicStreamConn) SetReadDeadline ¶ added in v0.33.12
func (q *QuicStreamConn) SetReadDeadline(t time.Time) error
func (*QuicStreamConn) SetWriteDeadline ¶ added in v0.33.12
func (q *QuicStreamConn) SetWriteDeadline(t time.Time) error
type RWConn ¶
type RWConn struct {
io.ReadWriteCloser
FakeAddr net.Addr
}
func NewRWConn ¶
func NewRWConn(conn io.ReadWriteCloser) *RWConn
func (*RWConn) RemoteAddr ¶
type SmartUdpConn ¶ added in v0.33.12
type SmartUdpConn struct {
// contains filtered or unexported fields
}
func NewSmartUdpConn ¶ added in v0.33.12
func NewSmartUdpConn(conns []net.PacketConn, addr *net.UDPAddr) *SmartUdpConn
func (*SmartUdpConn) Close ¶ added in v0.33.12
func (s *SmartUdpConn) Close() error
func (*SmartUdpConn) LocalAddr ¶ added in v0.33.12
func (s *SmartUdpConn) LocalAddr() net.Addr
func (*SmartUdpConn) SetDeadline ¶ added in v0.33.12
func (s *SmartUdpConn) SetDeadline(t time.Time) error
func (*SmartUdpConn) SetReadDeadline ¶ added in v0.33.12
func (s *SmartUdpConn) SetReadDeadline(t time.Time) error
func (*SmartUdpConn) SetWriteDeadline ¶ added in v0.33.12
func (s *SmartUdpConn) SetWriteDeadline(t time.Time) error
type SnappyConn ¶
type SnappyConn struct {
// contains filtered or unexported fields
}
func NewSnappyConn ¶
func NewSnappyConn(conn io.ReadWriteCloser) *SnappyConn
func (*SnappyConn) Close ¶
func (s *SnappyConn) Close() error
type TeeConn ¶ added in v0.33.12
type TeeConn struct {
// contains filtered or unexported fields
}
func (*TeeConn) ExtractAndReset ¶ added in v0.33.12
func (*TeeConn) RemoteAddr ¶ added in v0.33.12
func (*TeeConn) ResetBuffer ¶ added in v0.33.12
func (t *TeeConn) ResetBuffer()
func (*TeeConn) SetDeadline ¶ added in v0.33.12
func (*TeeConn) SetReadDeadline ¶ added in v0.33.12
func (*TeeConn) SetWriteDeadline ¶ added in v0.33.12
func (*TeeConn) StopAndClean ¶ added in v0.33.12
func (t *TeeConn) StopAndClean()
func (*TeeConn) StopBuffering ¶ added in v0.33.12
func (t *TeeConn) StopBuffering()
type TimeoutConn ¶ added in v0.33.12
type VirtualListener ¶ added in v0.33.12
type VirtualListener struct {
// contains filtered or unexported fields
}
func NewVirtualListener ¶ added in v0.33.12
func NewVirtualListener(addr net.Addr) *VirtualListener
func (*VirtualListener) Accept ¶ added in v0.33.12
func (l *VirtualListener) Accept() (net.Conn, error)
func (*VirtualListener) Addr ¶ added in v0.33.12
func (l *VirtualListener) Addr() net.Addr
func (*VirtualListener) Close ¶ added in v0.33.12
func (l *VirtualListener) Close() error
func (*VirtualListener) DialVirtual ¶ added in v0.33.12
func (l *VirtualListener) DialVirtual(rAddr string) (net.Conn, error)
func (*VirtualListener) ServeVirtual ¶ added in v0.33.12
func (l *VirtualListener) ServeVirtual(c net.Conn)
func (*VirtualListener) SetAddr ¶ added in v0.33.12
func (l *VirtualListener) SetAddr(addr net.Addr)
type WsConn ¶
func (*WsConn) RemoteAddr ¶
Click to show internal directories.
Click to hide internal directories.