Documentation
¶
Index ¶
- Constants
- Variables
- func ServeRPCStream(ctx context.Context, stream io.ReadWriteCloser, ...)
- func ServeV3RPCStream(ctx context.Context, stream io.ReadWriteCloser, ...)
- type CloudflaredServer
- func (s *CloudflaredServer) RegisterUdpSession(call tunnelrpc.SessionManager_registerUdpSession) error
- func (s *CloudflaredServer) UnregisterUdpSession(call tunnelrpc.SessionManager_unregisterUdpSession) error
- func (s *CloudflaredServer) UpdateConfiguration(call tunnelrpc.ConfigurationManager_updateConfiguration) error
- type CloudflaredV3Server
- func (s *CloudflaredV3Server) RegisterUdpSession(call tunnelrpc.SessionManager_registerUdpSession) error
- func (s *CloudflaredV3Server) UnregisterUdpSession(call tunnelrpc.SessionManager_unregisterUdpSession) error
- func (s *CloudflaredV3Server) UpdateConfiguration(call tunnelrpc.ConfigurationManager_updateConfiguration) error
- type DatagramV2Muxer
- func (m *DatagramV2Muxer) Close()
- func (m *DatagramV2Muxer) HandleDatagram(ctx context.Context, data []byte)
- func (m *DatagramV2Muxer) RegisterSession(ctx context.Context, sessionID uuid.UUID, destinationIP net.IP, ...) error
- func (m *DatagramV2Muxer) UnregisterSession(sessionID uuid.UUID, message string)
- type DatagramV3Muxer
- type DatagramV3SessionManager
- type FlowLimiter
- type MuxerContext
- type RPCStreamOpener
- type UDPSession
- func (s *UDPSession) Close() error
- func (s *UDPSession) LocalAddr() net.Addr
- func (s *UDPSession) ReadPacket(buffer *buf.Buffer) (M.Socksaddr, error)
- func (s *UDPSession) SetDeadline(_ time.Time) error
- func (s *UDPSession) SetReadDeadline(_ time.Time) error
- func (s *UDPSession) SetWriteDeadline(_ time.Time) error
- func (s *UDPSession) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error
- type V2SessionRPCClient
- type V3Session
Constants ¶
View Source
const ( V3RegistrationFlagLen = 1 V3RegistrationPortLen = 2 V3RegistrationIdleLen = 2 V3RequestIDLength = 16 V3IPv4AddrLen = 4 V3IPv6AddrLen = 16 V3PayloadHeaderLen = 1 + V3RequestIDLength V3FlagIPv6 byte = 0x01 V3ResponseDestinationUnreachable byte = 0x01 V3ResponseErrorWithMsg byte = 0xFF )
View Source
const SessionIDLength = 16
Variables ¶
View Source
var ( ErrUnsupportedDatagramV3UDPRegistration = E.New("datagram v3 does not support RegisterUdpSession RPC") ErrUnsupportedDatagramV3UDPUnregistration = E.New("datagram v3 does not support UnregisterUdpSession RPC") )
View Source
var NewV2SessionRPCClient = func(ctx context.Context, sender protocol.DatagramSender) (V2SessionRPCClient, error) { opener, ok := sender.(RPCStreamOpener) if !ok { return nil, E.New("sender does not support rpc streams") } stream, err := opener.OpenRPCStream(ctx) if err != nil { return nil, err } transport := control.SafeTransport(stream) conn := control.NewRPCClientConn(transport) return &capnpV2SessionRPCClient{ client: tunnelrpc.SessionManager{Client: conn.Bootstrap(ctx)}, rpcConn: conn, transport: transport, }, nil }
Functions ¶
func ServeRPCStream ¶
func ServeRPCStream(ctx context.Context, stream io.ReadWriteCloser, applyConfig control.ConfigApplier, muxer *DatagramV2Muxer, log logger.ContextLogger)
func ServeV3RPCStream ¶
func ServeV3RPCStream(ctx context.Context, stream io.ReadWriteCloser, applyConfig control.ConfigApplier, log logger.ContextLogger)
Types ¶
type CloudflaredServer ¶
type CloudflaredServer struct {
// contains filtered or unexported fields
}
func (*CloudflaredServer) RegisterUdpSession ¶
func (s *CloudflaredServer) RegisterUdpSession(call tunnelrpc.SessionManager_registerUdpSession) error
func (*CloudflaredServer) UnregisterUdpSession ¶
func (s *CloudflaredServer) UnregisterUdpSession(call tunnelrpc.SessionManager_unregisterUdpSession) error
func (*CloudflaredServer) UpdateConfiguration ¶
func (s *CloudflaredServer) UpdateConfiguration(call tunnelrpc.ConfigurationManager_updateConfiguration) error
type CloudflaredV3Server ¶
type CloudflaredV3Server struct {
// contains filtered or unexported fields
}
func (*CloudflaredV3Server) RegisterUdpSession ¶
func (s *CloudflaredV3Server) RegisterUdpSession(call tunnelrpc.SessionManager_registerUdpSession) error
func (*CloudflaredV3Server) UnregisterUdpSession ¶
func (s *CloudflaredV3Server) UnregisterUdpSession(call tunnelrpc.SessionManager_unregisterUdpSession) error
func (*CloudflaredV3Server) UpdateConfiguration ¶
func (s *CloudflaredV3Server) UpdateConfiguration(call tunnelrpc.ConfigurationManager_updateConfiguration) error
type DatagramV2Muxer ¶
type DatagramV2Muxer struct {
// contains filtered or unexported fields
}
func NewDatagramV2Muxer ¶
func NewDatagramV2Muxer(muxerContext MuxerContext, sender protocol.DatagramSender, log logger.ContextLogger) *DatagramV2Muxer
func (*DatagramV2Muxer) Close ¶
func (m *DatagramV2Muxer) Close()
func (*DatagramV2Muxer) HandleDatagram ¶
func (m *DatagramV2Muxer) HandleDatagram(ctx context.Context, data []byte)
func (*DatagramV2Muxer) RegisterSession ¶
func (*DatagramV2Muxer) UnregisterSession ¶
func (m *DatagramV2Muxer) UnregisterSession(sessionID uuid.UUID, message string)
type DatagramV3Muxer ¶
type DatagramV3Muxer struct {
// contains filtered or unexported fields
}
func NewDatagramV3Muxer ¶
func NewDatagramV3Muxer(muxerContext MuxerContext, sender protocol.DatagramSender, log logger.ContextLogger, manager *DatagramV3SessionManager) *DatagramV3Muxer
func (*DatagramV3Muxer) Close ¶
func (m *DatagramV3Muxer) Close()
func (*DatagramV3Muxer) HandleDatagram ¶
func (m *DatagramV3Muxer) HandleDatagram(ctx context.Context, data []byte)
type DatagramV3SessionManager ¶
type DatagramV3SessionManager struct {
// contains filtered or unexported fields
}
func NewDatagramV3SessionManager ¶
func NewDatagramV3SessionManager() *DatagramV3SessionManager
type FlowLimiter ¶
type FlowLimiter struct {
// contains filtered or unexported fields
}
func (*FlowLimiter) Acquire ¶
func (l *FlowLimiter) Acquire(limit uint64) bool
func (*FlowLimiter) Release ¶
func (l *FlowLimiter) Release(limit uint64)
type MuxerContext ¶
type MuxerContext struct {
Context context.Context
Logger logger.ContextLogger
MaxActiveFlows func() uint64
FlowLimiter *FlowLimiter
DialPacket func(ctx context.Context, destination M.Socksaddr) (N.PacketConn, error)
ICMPHandler icmp.RouteHandler
}
type RPCStreamOpener ¶
type RPCStreamOpener interface {
OpenRPCStream(ctx context.Context) (io.ReadWriteCloser, error)
}
type UDPSession ¶
type UDPSession struct {
// contains filtered or unexported fields
}
func NewUDPSession ¶
func NewUDPSession(id uuid.UUID, destination netip.AddrPort, closeAfterIdle time.Duration, origin N.PacketConn, muxer *DatagramV2Muxer) *UDPSession
func (*UDPSession) Close ¶
func (s *UDPSession) Close() error
func (*UDPSession) LocalAddr ¶
func (s *UDPSession) LocalAddr() net.Addr
func (*UDPSession) ReadPacket ¶
func (*UDPSession) SetDeadline ¶
func (s *UDPSession) SetDeadline(_ time.Time) error
func (*UDPSession) SetReadDeadline ¶
func (s *UDPSession) SetReadDeadline(_ time.Time) error
func (*UDPSession) SetWriteDeadline ¶
func (s *UDPSession) SetWriteDeadline(_ time.Time) error
func (*UDPSession) WritePacket ¶
type V2SessionRPCClient ¶
Click to show internal directories.
Click to hide internal directories.