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 ConnectServerByProxy ¶
func ConnectWebsocketServer ¶
addr: domain:port
func HTTPBasicAuth ¶
func HTTPBasicAuth(h http.HandlerFunc, user, passwd string) http.HandlerFunc
func NewHTTPBasicAuthWraper ¶
func NewKCPConnFromUDP ¶
func WrapCloseNotifyConn ¶
closeFn will be only called once
Types ¶
type CloseNotifyConn ¶
func (*CloseNotifyConn) Close ¶
func (cc *CloseNotifyConn) Close() (err error)
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 CustomListener ¶
type CustomListener struct {
// contains filtered or unexported fields
}
Custom listener
func NewCustomListener ¶
func NewCustomListener() *CustomListener
func (*CustomListener) Addr ¶
func (l *CustomListener) Addr() net.Addr
func (*CustomListener) Close ¶
func (l *CustomListener) Close() error
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(t time.Time) error
func (*FakeUDPConn) SetReadDeadline ¶
func (c *FakeUDPConn) SetReadDeadline(t time.Time) error
func (*FakeUDPConn) SetWriteDeadline ¶
func (c *FakeUDPConn) SetWriteDeadline(t 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
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 KCPListener ¶
type KCPListener struct {
// contains filtered or unexported fields
}
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
Click to show internal directories.
Click to hide internal directories.