Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAndEnableTLSServerConnWithTimeout(c net.Conn, tlsConfig *tls.Config, tlsOnly bool, timeout time.Duration) (out net.Conn, isTLS bool, custom bool, err error)
- func DialHookCustomTLSHeadByte(enableTLS bool, disableCustomTLSHeadByte bool) libnet.AfterHookFunc
- func DialHookWebsocket(protocol string, host string) libnet.AfterHookFunc
- func MakeHTTPGzipHandler(h http.Handler) http.Handler
- func NewContextFromConn(conn net.Conn) context.Context
- func NewCryptoReadWriter(rw io.ReadWriter, key []byte) (io.ReadWriter, error)
- func NewKCPConnFromUDP(conn *net.UDPConn, connected bool, raddr string) (net.Conn, error)
- func NewLogFromConn(conn net.Conn) *xlog.Logger
- func QuicStreamToNetConn(s quic.Stream, c quic.Connection) net.Conn
- func SetDefaultDNSAddress(dnsAddress string)
- func WrapCloseNotifyConn(c net.Conn, closeFn func()) net.Conn
- type CloseNotifyConn
- type ConnectedUDPConn
- type ContextConn
- type ContextGetter
- type ContextSetter
- type FakeUDPConn
- func (c *FakeUDPConn) Close() error
- func (c *FakeUDPConn) IsClosed() bool
- func (c *FakeUDPConn) LocalAddr() net.Addr
- func (c *FakeUDPConn) Read(b []byte) (n int, err error)
- func (c *FakeUDPConn) RemoteAddr() net.Addr
- func (c *FakeUDPConn) SetDeadline(_ time.Time) error
- func (c *FakeUDPConn) SetReadDeadline(_ time.Time) error
- func (c *FakeUDPConn) SetWriteDeadline(_ time.Time) error
- func (c *FakeUDPConn) Write(b []byte) (n int, err error)
- type HTTPAuthMiddleware
- type HTTPGzipWrapper
- type InternalAddr
- type InternalListener
- type KCPListener
- type StatsConn
- type UDPListener
- type UDPPacket
- type WebsocketListener
- type WrapReadWriteCloserConn
- func (conn *WrapReadWriteCloserConn) LocalAddr() net.Addr
- func (conn *WrapReadWriteCloserConn) RemoteAddr() net.Addr
- func (conn *WrapReadWriteCloserConn) SetDeadline(t time.Time) error
- func (conn *WrapReadWriteCloserConn) SetReadDeadline(t time.Time) error
- func (conn *WrapReadWriteCloserConn) SetRemoteAddr(addr net.Addr)
- func (conn *WrapReadWriteCloserConn) SetWriteDeadline(t time.Time) error
Constants ¶
View Source
const (
FrpWebsocketPath = "/~!frp"
)
Variables ¶
View Source
var ErrWebsocketListenerClosed = errors.New("websocket listener closed")
View Source
var FRPTLSHeadByte = 0x17
Functions ¶
func DialHookCustomTLSHeadByte ¶
func DialHookCustomTLSHeadByte(enableTLS bool, disableCustomTLSHeadByte bool) libnet.AfterHookFunc
func DialHookWebsocket ¶
func DialHookWebsocket(protocol string, host string) libnet.AfterHookFunc
func NewCryptoReadWriter ¶
func NewCryptoReadWriter(rw io.ReadWriter, key []byte) (io.ReadWriter, error)
func NewKCPConnFromUDP ¶
func QuicStreamToNetConn ¶
func SetDefaultDNSAddress ¶
func SetDefaultDNSAddress(dnsAddress string)
Types ¶
type CloseNotifyConn ¶
func (*CloseNotifyConn) Close ¶
func (cc *CloseNotifyConn) Close() (err error)
type ConnectedUDPConn ¶
ConnectedUDPConn is a wrapper for net.UDPConn which converts WriteTo syscalls to Write syscalls that are 4 times faster on some OS'es. This should only be used for connections that were produced by a net.Dial* call.
type ContextConn ¶
ContextConn is the connection with context
func NewContextConn ¶
func NewContextConn(ctx context.Context, c net.Conn) *ContextConn
func (*ContextConn) Context ¶
func (c *ContextConn) Context() context.Context
func (*ContextConn) WithContext ¶
func (c *ContextConn) WithContext(ctx context.Context)
type ContextGetter ¶
type ContextSetter ¶
type FakeUDPConn ¶
type FakeUDPConn struct {
// contains filtered or unexported fields
}
func NewFakeUDPConn ¶
func NewFakeUDPConn(l *UDPListener, laddr, raddr net.Addr) *FakeUDPConn
func (*FakeUDPConn) Close ¶
func (c *FakeUDPConn) Close() error
func (*FakeUDPConn) IsClosed ¶
func (c *FakeUDPConn) IsClosed() bool
func (*FakeUDPConn) LocalAddr ¶
func (c *FakeUDPConn) LocalAddr() net.Addr
func (*FakeUDPConn) RemoteAddr ¶
func (c *FakeUDPConn) RemoteAddr() net.Addr
func (*FakeUDPConn) SetDeadline ¶
func (c *FakeUDPConn) SetDeadline(_ time.Time) error
func (*FakeUDPConn) SetReadDeadline ¶
func (c *FakeUDPConn) SetReadDeadline(_ time.Time) error
func (*FakeUDPConn) SetWriteDeadline ¶
func (c *FakeUDPConn) SetWriteDeadline(_ time.Time) error
type HTTPAuthMiddleware ¶
type HTTPAuthMiddleware struct {
// contains filtered or unexported fields
}
func NewHTTPAuthMiddleware ¶
func NewHTTPAuthMiddleware(user, passwd string) *HTTPAuthMiddleware
func (*HTTPAuthMiddleware) Middleware ¶
func (authMid *HTTPAuthMiddleware) Middleware(next http.Handler) http.Handler
func (*HTTPAuthMiddleware) SetAuthFailDelay ¶
func (authMid *HTTPAuthMiddleware) SetAuthFailDelay(delay time.Duration) *HTTPAuthMiddleware
type HTTPGzipWrapper ¶
type HTTPGzipWrapper struct {
// contains filtered or unexported fields
}
func (*HTTPGzipWrapper) ServeHTTP ¶
func (gw *HTTPGzipWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request)
type InternalAddr ¶
type InternalAddr struct{}
func (*InternalAddr) Network ¶
func (ia *InternalAddr) Network() string
func (*InternalAddr) String ¶
func (ia *InternalAddr) String() string
type InternalListener ¶
type InternalListener struct {
// contains filtered or unexported fields
}
InternalListener is a listener that can be used to accept connections from other goroutines.
func NewInternalListener ¶
func NewInternalListener() *InternalListener
func (*InternalListener) Addr ¶
func (l *InternalListener) Addr() net.Addr
func (*InternalListener) Close ¶
func (l *InternalListener) Close() error
type KCPListener ¶
type KCPListener struct {
// contains filtered or unexported fields
}
func ListenKcp ¶
func ListenKcp(address string) (l *KCPListener, err error)
func (*KCPListener) Addr ¶
func (l *KCPListener) Addr() net.Addr
func (*KCPListener) Close ¶
func (l *KCPListener) Close() error
type StatsConn ¶
func WrapStatsConn ¶
type UDPListener ¶
type UDPListener struct {
// contains filtered or unexported fields
}
func (*UDPListener) Addr ¶
func (l *UDPListener) Addr() net.Addr
func (*UDPListener) Close ¶
func (l *UDPListener) Close() error
type WebsocketListener ¶
type WebsocketListener struct {
// contains filtered or unexported fields
}
func NewWebsocketListener ¶
func NewWebsocketListener(ln net.Listener) (wl *WebsocketListener)
NewWebsocketListener to handle websocket connections ln: tcp listener for websocket connections
func (*WebsocketListener) Addr ¶
func (p *WebsocketListener) Addr() net.Addr
func (*WebsocketListener) Close ¶
func (p *WebsocketListener) Close() error
type WrapReadWriteCloserConn ¶
type WrapReadWriteCloserConn struct { io.ReadWriteCloser // contains filtered or unexported fields }
func WrapReadWriteCloserToConn ¶
func WrapReadWriteCloserToConn(rwc io.ReadWriteCloser, underConn net.Conn) *WrapReadWriteCloserConn
func (*WrapReadWriteCloserConn) LocalAddr ¶
func (conn *WrapReadWriteCloserConn) LocalAddr() net.Addr
func (*WrapReadWriteCloserConn) RemoteAddr ¶
func (conn *WrapReadWriteCloserConn) RemoteAddr() net.Addr
func (*WrapReadWriteCloserConn) SetDeadline ¶
func (conn *WrapReadWriteCloserConn) SetDeadline(t time.Time) error
func (*WrapReadWriteCloserConn) SetReadDeadline ¶
func (conn *WrapReadWriteCloserConn) SetReadDeadline(t time.Time) error
func (*WrapReadWriteCloserConn) SetRemoteAddr ¶
func (conn *WrapReadWriteCloserConn) SetRemoteAddr(addr net.Addr)
func (*WrapReadWriteCloserConn) SetWriteDeadline ¶
func (conn *WrapReadWriteCloserConn) SetWriteDeadline(t time.Time) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.