Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAndEnableTLSServerConnWithTimeout(c net.Conn, tlsConfig *tls.Config, tlsOnly bool, timeout time.Duration) (out net.Conn, err error)
- func ConnectServer(protocol string, addr string) (c net.Conn, err error)
- func ConnectServerByProxy(proxyURL string, protocol string, addr string) (c net.Conn, err error)
- func ConnectServerByProxyWithTLS(proxyURL string, protocol string, addr string, tlsConfig *tls.Config) (c net.Conn, err error)
- func ConnectWebsocketServer(addr string) (net.Conn, error)
- 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
- func WrapTLSClientConn(c net.Conn, tlsConfig *tls.Config) (out net.Conn)
- type CloseNotifyConn
- type ContextConn
- type ContextGetter
- type ContextSetter
- type CustomListener
- 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(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
- type HTTPAuthWraper
- type HTTPGzipWraper
- 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 = "/~!frp"
)
Variables ¶
View Source
var (
ErrWebsocketListenerClosed = errors.New("websocket listener closed")
)
View Source
var (
FRPTLSHeadByte = 0x17
)
Functions ¶
func CheckAndEnableTLSServerConnWithTimeout ¶ added in v0.27.1
func ConnectServer ¶ added in v0.12.0
func ConnectServerByProxy ¶ added in v0.19.0
func ConnectServerByProxyWithTLS ¶ added in v0.25.0
func ConnectWebsocketServer ¶ added in v0.21.0
addr: domain:port
func HTTPBasicAuth ¶ added in v0.34.0
func HTTPBasicAuth(h http.HandlerFunc, user, passwd string) http.HandlerFunc
func NewHTTPBasicAuthWraper ¶ added in v0.34.0
func NewKCPConnFromUDP ¶ added in v0.34.0
func WrapCloseNotifyConn ¶ added in v0.21.0
closeFn will be only called once
func WrapReadWriteCloserToConn ¶ added in v0.11.0
Types ¶
type CloseNotifyConn ¶ added in v0.21.0
func (*CloseNotifyConn) Close ¶ added in v0.21.0
func (cc *CloseNotifyConn) Close() (err error)
type ContextConn ¶ added in v0.29.1
ContextConn is the connection with context
func NewContextConn ¶ added in v0.29.1
func NewContextConn(ctx context.Context, c net.Conn) *ContextConn
func (*ContextConn) Context ¶ added in v0.29.1
func (c *ContextConn) Context() context.Context
func (*ContextConn) WithContext ¶ added in v0.29.1
func (c *ContextConn) WithContext(ctx context.Context)
type ContextGetter ¶ added in v0.29.1
type ContextSetter ¶ added in v0.29.1
type CustomListener ¶ added in v0.13.0
type CustomListener struct {
// contains filtered or unexported fields
}
Custom listener
func NewCustomListener ¶ added in v0.13.0
func NewCustomListener() *CustomListener
func (*CustomListener) Accept ¶ added in v0.13.0
func (l *CustomListener) Accept() (net.Conn, error)
func (*CustomListener) Addr ¶ added in v0.13.0
func (l *CustomListener) Addr() net.Addr
func (*CustomListener) Close ¶ added in v0.13.0
func (l *CustomListener) Close() error
type FakeUDPConn ¶ added in v0.34.0
type FakeUDPConn struct {
// contains filtered or unexported fields
}
func NewFakeUDPConn ¶ added in v0.34.0
func NewFakeUDPConn(l *UDPListener, laddr, raddr net.Addr) *FakeUDPConn
func (*FakeUDPConn) Close ¶ added in v0.34.0
func (c *FakeUDPConn) Close() error
func (*FakeUDPConn) IsClosed ¶ added in v0.34.0
func (c *FakeUDPConn) IsClosed() bool
func (*FakeUDPConn) LocalAddr ¶ added in v0.34.0
func (c *FakeUDPConn) LocalAddr() net.Addr
func (*FakeUDPConn) RemoteAddr ¶ added in v0.34.0
func (c *FakeUDPConn) RemoteAddr() net.Addr
func (*FakeUDPConn) SetDeadline ¶ added in v0.34.0
func (c *FakeUDPConn) SetDeadline(t time.Time) error
func (*FakeUDPConn) SetReadDeadline ¶ added in v0.34.0
func (c *FakeUDPConn) SetReadDeadline(t time.Time) error
func (*FakeUDPConn) SetWriteDeadline ¶ added in v0.34.0
func (c *FakeUDPConn) SetWriteDeadline(t time.Time) error
type HTTPAuthMiddleware ¶ added in v0.34.0
type HTTPAuthMiddleware struct {
// contains filtered or unexported fields
}
func NewHTTPAuthMiddleware ¶ added in v0.34.0
func NewHTTPAuthMiddleware(user, passwd string) *HTTPAuthMiddleware
func (*HTTPAuthMiddleware) Middleware ¶ added in v0.34.0
func (authMid *HTTPAuthMiddleware) Middleware(next http.Handler) http.Handler
type HTTPAuthWraper ¶ added in v0.34.0
type HTTPAuthWraper struct {
// contains filtered or unexported fields
}
func (*HTTPAuthWraper) ServeHTTP ¶ added in v0.34.0
func (aw *HTTPAuthWraper) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HTTPGzipWraper ¶ added in v0.34.0
type HTTPGzipWraper struct {
// contains filtered or unexported fields
}
func (*HTTPGzipWraper) ServeHTTP ¶ added in v0.34.0
func (gw *HTTPGzipWraper) ServeHTTP(w http.ResponseWriter, r *http.Request)
type KCPListener ¶ added in v0.34.0
type KCPListener struct {
// contains filtered or unexported fields
}
func ListenKcp ¶ added in v0.12.0
func ListenKcp(bindAddr string, bindPort int) (l *KCPListener, err error)
func (*KCPListener) Addr ¶ added in v0.34.0
func (l *KCPListener) Addr() net.Addr
func (*KCPListener) Close ¶ added in v0.34.0
func (l *KCPListener) Close() error
type StatsConn ¶ added in v0.15.0
func WrapStatsConn ¶ added in v0.15.0
type UDPListener ¶ added in v0.34.0
type UDPListener struct {
// contains filtered or unexported fields
}
func (*UDPListener) Addr ¶ added in v0.34.0
func (l *UDPListener) Addr() net.Addr
func (*UDPListener) Close ¶ added in v0.34.0
func (l *UDPListener) Close() error
type WebsocketListener ¶ added in v0.21.0
type WebsocketListener struct {
// contains filtered or unexported fields
}
func ListenWebsocket ¶ added in v0.21.0
func ListenWebsocket(bindAddr string, bindPort int) (*WebsocketListener, error)
func NewWebsocketListener ¶ added in v0.21.0
func NewWebsocketListener(ln net.Listener) (wl *WebsocketListener)
NewWebsocketListener to handle websocket connections ln: tcp listener for websocket connections
func (*WebsocketListener) Accept ¶ added in v0.21.0
func (p *WebsocketListener) Accept() (net.Conn, error)
func (*WebsocketListener) Addr ¶ added in v0.29.1
func (p *WebsocketListener) Addr() net.Addr
func (*WebsocketListener) Close ¶ added in v0.21.0
func (p *WebsocketListener) Close() error
type WrapReadWriteCloserConn ¶ added in v0.11.0
type WrapReadWriteCloserConn struct { io.ReadWriteCloser // contains filtered or unexported fields }
func (*WrapReadWriteCloserConn) LocalAddr ¶ added in v0.11.0
func (conn *WrapReadWriteCloserConn) LocalAddr() net.Addr
func (*WrapReadWriteCloserConn) RemoteAddr ¶ added in v0.11.0
func (conn *WrapReadWriteCloserConn) RemoteAddr() net.Addr
func (*WrapReadWriteCloserConn) SetDeadline ¶ added in v0.11.0
func (conn *WrapReadWriteCloserConn) SetDeadline(t time.Time) error
func (*WrapReadWriteCloserConn) SetReadDeadline ¶ added in v0.11.0
func (conn *WrapReadWriteCloserConn) SetReadDeadline(t time.Time) error
func (*WrapReadWriteCloserConn) SetWriteDeadline ¶ added in v0.11.0
func (conn *WrapReadWriteCloserConn) SetWriteDeadline(t time.Time) error
Click to show internal directories.
Click to hide internal directories.