Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAndEnableTLSServerConnWithTimeout(c net.Conn, tlsConfig *tls.Config, 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 (
FRP_TLS_HEAD_BYTE = 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(c net.Conn, ctx context.Context) *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.