Documentation
¶
Index ¶
- type AssignedAddress
- type CloseError
- type Conn
- func (c *Conn) AdvertiseRoute(ctx context.Context, routes []IPRoute) error
- func (c *Conn) AssignAddresses(ctx context.Context, prefixes []netip.Prefix) error
- func (c *Conn) Close() error
- func (c *Conn) LocalPrefixes(ctx context.Context) ([]netip.Prefix, error)
- func (c *Conn) ReadPacket() (b []byte, err error)
- func (c *Conn) ReadPacketBuffer() (*PacketBuffer, error)
- func (c *Conn) Routes(ctx context.Context) ([]IPRoute, error)
- func (c *Conn) TryReadPacket() (b []byte, err error)
- func (c *Conn) TryReadPacketBuffer() (*PacketBuffer, error)
- func (c *Conn) WritePacket(b []byte) (icmp []byte, err error)
- func (c *Conn) WritePacketBuffer(buf []byte, offset, length int) (icmp []byte, err error)
- func (c *Conn) WritePacketBufferOwned(buf []byte, offset, length int, owner PacketPayloadOwner) (icmp []byte, err error)
- type Http3Stream
- type IPRoute
- type PacketBuffer
- type PacketPayloadOwner
- type Proxy
- type Request
- type RequestParseError
- type RequestedAddress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssignedAddress ¶
AssignedAddress represents an Assigned Address within an ADDRESS_ASSIGN capsule
type CloseError ¶
type CloseError struct {
Remote bool
}
func (*CloseError) Error ¶
func (e *CloseError) Error() string
func (*CloseError) Is ¶
func (e *CloseError) Is(target error) bool
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a connection that proxies IP packets over HTTP/3.
func Dial ¶
func Dial(ctx context.Context, conn *http3.ClientConn, template *uritemplate.Template) (*Conn, *http.Response, error)
Dial dials a proxied connection to a target server.
func NewProxiedConn ¶
func NewProxiedConn(str Http3Stream) *Conn
func (*Conn) AdvertiseRoute ¶
AdvertiseRoute informs the peer about available routes. This function can be called multiple times, but only the routes from the most recent call will be active. Previous route advertisements are overwritten by each new call to this function.
func (*Conn) AssignAddresses ¶
AssignAddresses assigned address prefixes to the peer. This function can be called multiple times, but only the addresses from the most recent call will be active. Previous address assignments are overwritten by each new call to this function.
func (*Conn) LocalPrefixes ¶
LocalPrefixes returns the prefixes that the peer currently assigned. Note that at any point during the connection, the peer can change the assignment. It is therefore recommended to call this function in a loop.
func (*Conn) ReadPacket ¶
func (*Conn) ReadPacketBuffer ¶
func (c *Conn) ReadPacketBuffer() (*PacketBuffer, error)
func (*Conn) Routes ¶
Routes returns the routes that the peer currently advertised. Note that at any point during the connection, the peer can change the advertised routes. It is therefore recommended to call this function in a loop.
func (*Conn) TryReadPacket ¶
TryReadPacket returns one already-queued IP packet without waiting for a future QUIC DATAGRAM. It is intended for bounded opportunistic draining. ReadPacket retains its blocking behavior for existing callers.
func (*Conn) TryReadPacketBuffer ¶
func (c *Conn) TryReadPacketBuffer() (*PacketBuffer, error)
func (*Conn) WritePacket ¶
WritePacket writes an IP packet to the stream. If sending the packet fails, it might return an ICMP packet. It is the caller's responsibility to send the ICMP packet to the sender.
func (*Conn) WritePacketBuffer ¶
WritePacketBuffer sends buf[offset:offset+length]. When offset provides the one-byte CONNECT-IP Context ID headroom, it prepends in place and avoids the CONNECT-IP allocation/copy. quic-go copies into its own datagram frame before returning, so callers may immediately reuse buf after this call.
func (*Conn) WritePacketBufferOwned ¶
func (c *Conn) WritePacketBufferOwned(buf []byte, offset, length int, owner PacketPayloadOwner) (icmp []byte, err error)
WritePacketBufferOwned sends an IP packet while transferring ownership of buf to the asynchronous HTTP/3 / QUIC path. The owner is released by this method unless the owned lower layer accepts the buffer. Callers must not release owner after this method returns.
type Http3Stream ¶
type Http3Stream = http3Stream
type IPRoute ¶
type IPRoute struct {
StartIP netip.Addr
EndIP netip.Addr
// IPProtocol is the Internet Protocol Number for traffic that can be sent to this range.
// If the value is 0, all protocols are allowed.
IPProtocol uint8
}
IPRoute represents an IP Address Range
type PacketBuffer ¶
type PacketBuffer quic.DatagramBuffer
PacketBuffer is a named pointer view over quic.DatagramBuffer. The buffer-aware receive path converts the pointer without allocating another handle object. Release and its exactly-once semantics are owned by the QUIC DatagramBuffer.
func (*PacketBuffer) Release ¶
func (b *PacketBuffer) Release()
type PacketPayloadOwner ¶
type PacketPayloadOwner interface{ Release() }
PacketPayloadOwner owns the caller's packet backing. WritePacketBufferOwned releases it on every non-transferred path and transfers it to the HTTP/3 / QUIC send queue only after that queue accepts the frame.
type Request ¶
type Request struct{}
Request is the parsed CONNECT-IP request returned from ParseRequest. It currently doesn't have any fields, since masque-go doesn't support IP flow forwarding.
func ParseRequest ¶
ParseRequest parses a CONNECT-IP request. The template is the URI template that clients will use to configure this proxy.
type RequestParseError ¶
RequestParseError is returned from ParseRequest if parsing the CONNECT-UDP request fails. It is recommended that the request is rejected with the corresponding HTTP status code.
func (*RequestParseError) Error ¶
func (e *RequestParseError) Error() string
func (*RequestParseError) Unwrap ¶
func (e *RequestParseError) Unwrap() error
type RequestedAddress ¶
RequestedAddress represents an Requested Address within an ADDRESS_REQUEST capsule