Versions in this module Expand all Collapse all v0 v0.45.1 Nov 12, 2022 v0.45.0 Nov 12, 2022 Changes in this version + const FrpWebsocketPath + var ErrWebsocketListenerClosed = errors.New("websocket listener closed") + var FRPTLSHeadByte = 0x17 + 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) libdial.AfterHookFunc + func DialHookWebsocket() libdial.AfterHookFunc + func HTTPBasicAuth(h http.HandlerFunc, user, passwd string) http.HandlerFunc + func MakeHTTPGzipHandler(h http.Handler) http.Handler + func NewContextFromConn(conn net.Conn) context.Context + func NewHTTPBasicAuthWraper(h http.Handler, user, passwd string) http.Handler + func NewKCPConnFromUDP(conn *net.UDPConn, connected bool, raddr string) (net.Conn, error) + func NewLogFromConn(conn net.Conn) *xlog.Logger + func WrapCloseNotifyConn(c net.Conn, closeFn func()) net.Conn + func WrapReadWriteCloserToConn(rwc io.ReadWriteCloser, underConn net.Conn) net.Conn + type CloseNotifyConn struct + func (cc *CloseNotifyConn) Close() (err error) + type ContextConn struct + func NewContextConn(ctx context.Context, c net.Conn) *ContextConn + func (c *ContextConn) Context() context.Context + func (c *ContextConn) WithContext(ctx context.Context) + type ContextGetter interface + Context func() context.Context + type ContextSetter interface + WithContext func(ctx context.Context) + type CustomListener struct + func NewCustomListener() *CustomListener + func (l *CustomListener) Accept() (net.Conn, error) + func (l *CustomListener) Addr() net.Addr + func (l *CustomListener) Close() error + func (l *CustomListener) PutConn(conn net.Conn) error + type FakeUDPConn struct + func NewFakeUDPConn(l *UDPListener, laddr, raddr net.Addr) *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(t time.Time) error + func (c *FakeUDPConn) SetReadDeadline(t time.Time) error + func (c *FakeUDPConn) SetWriteDeadline(t time.Time) error + func (c *FakeUDPConn) Write(b []byte) (n int, err error) + type HTTPAuthMiddleware struct + func NewHTTPAuthMiddleware(user, passwd string) *HTTPAuthMiddleware + func (authMid *HTTPAuthMiddleware) Middleware(next http.Handler) http.Handler + type HTTPAuthWraper struct + func (aw *HTTPAuthWraper) ServeHTTP(w http.ResponseWriter, r *http.Request) + type HTTPGzipWraper struct + func (gw *HTTPGzipWraper) ServeHTTP(w http.ResponseWriter, r *http.Request) + type KCPListener struct + func ListenKcp(address string) (l *KCPListener, err error) + func (l *KCPListener) Accept() (net.Conn, error) + func (l *KCPListener) Addr() net.Addr + func (l *KCPListener) Close() error + type StatsConn struct + func WrapStatsConn(conn net.Conn, statsFunc func(total, totalWrite int64)) *StatsConn + func (statsConn *StatsConn) Close() (err error) + func (statsConn *StatsConn) Read(p []byte) (n int, err error) + func (statsConn *StatsConn) Write(p []byte) (n int, err error) + type UDPListener struct + func ListenUDP(bindAddr string, bindPort int) (l *UDPListener, err error) + func (l *UDPListener) Accept() (net.Conn, error) + func (l *UDPListener) Addr() net.Addr + func (l *UDPListener) Close() error + func (l *UDPListener) WriteMsg(buf []byte, remoteAddr *net.UDPAddr) (err error) + type UDPPacket struct + Buf []byte + LocalAddr net.Addr + RemoteAddr net.Addr + type WebsocketListener struct + func ListenWebsocket(bindAddr string, bindPort int) (*WebsocketListener, error) + func NewWebsocketListener(ln net.Listener) (wl *WebsocketListener) + func (p *WebsocketListener) Accept() (net.Conn, error) + func (p *WebsocketListener) Addr() net.Addr + func (p *WebsocketListener) Close() error + type WrapReadWriteCloserConn struct + 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) SetWriteDeadline(t time.Time) error