 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package relay holds low-level primitives for proxying streams to a WireGuard interface. The package can later be abstracted to support other proxying mechanisms.
Index ¶
Constants ¶
      View Source
      
  const DefaultUDPBuffer = 1024 * 1024 * 4
    DefaultUDPBuffer is the default buffer size to use for UDP relays.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalUDP ¶
LocalUDP is a local UDP relay.
func (*LocalUDP) Closed ¶
func (r *LocalUDP) Closed() <-chan struct{}
Closed returns a channel that is closed when the relay is closed.
type Relay ¶
type Relay interface {
	// Relay proxies data to and from the given stream.
	Relay(ctx context.Context, from io.ReadWriteCloser) error
	// LocalAddr returns the local address of the relay.
	LocalAddr() netip.AddrPort
	// Closed returns a channel that is closed when the relay is closed.
	Closed() <-chan struct{}
	// Close closes the relay.
	Close() error
}
    Relay is a generic interface for proxying read-write streams between each other.
func NewLocalUDP ¶
func NewLocalUDP(opts UDPOptions) (Relay, error)
NewLocalUDP creates a new UDP relay listening on the given port and proxying traffic to the listener on the given target port.
type UDPOptions ¶
type UDPOptions struct {
	// TargetPort is the port to proxy traffic to.
	TargetPort uint16
	// BufferSize is the size of the buffer to use for copying data.
	// If 0, DefaultUDPBuffer will be used.
	BufferSize int
}
    UDPOptions are generic options for a UDP relay.
 Click to show internal directories. 
   Click to hide internal directories.