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) libdial.AfterHookFunc
- func DialHookWebsocket(protocol string, host string) libdial.AfterHookFunc
- 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 QuicStreamToNetConn(s quic.Stream, c quic.Connection) net.Conn
- func WrapCloseNotifyConn(c net.Conn, closeFn func()) net.Conn
- func WrapReadWriteCloserToConn(rwc io.ReadWriteCloser, underConn net.Conn) 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 HTTPAuthWraper
- type HTTPGzipWraper
- 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) SetWriteDeadline(t time.Time) error
Constants ¶
View Source
const (
FrpWebsocketPath = "/~!FastRP"
)
Variables ¶
View Source
var ErrWebsocketListenerClosed = errors.New("websocket listener closed")
View Source
var FRPTLSHeadByte = 0x17
Functions ¶
func DialHookCustomTLSHeadByte ¶
func DialHookCustomTLSHeadByte(enableTLS bool, disableCustomTLSHeadByte bool) libdial.AfterHookFunc
func DialHookWebsocket ¶
func DialHookWebsocket(protocol string, host string) libdial.AfterHookFunc
func NewHTTPBasicAuthWraper ¶
func NewKCPConnFromUDP ¶
func QuicStreamToNetConn ¶
func WrapCloseNotifyConn ¶
closeFn will be only called once
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 HTTPAuthWraper ¶
type HTTPAuthWraper struct {
// contains filtered or unexported fields
}
func (*HTTPAuthWraper) ServeHTTP ¶
func (aw *HTTPAuthWraper) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HTTPGzipWraper ¶
type HTTPGzipWraper struct {
// contains filtered or unexported fields
}
func (*HTTPGzipWraper) ServeHTTP ¶
func (gw *HTTPGzipWraper) 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 ListenWebsocket ¶
func ListenWebsocket(bindAddr string, bindPort int) (*WebsocketListener, error)
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 (*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) SetWriteDeadline ¶
func (conn *WrapReadWriteCloserConn) SetWriteDeadline(t time.Time) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.