udp

package
v4.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(address string) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Recv

func (c *Client) Recv(b []byte, timeout time.Duration) (int, net.Addr, error)

func (*Client) Send

func (c *Client) Send(b []byte) (int, error)

type Handler

type Handler func(net.PacketConn, []byte, net.Addr)

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

func NewProxy

func NewProxy(conf ProxyConfig) *Proxy

func (*Proxy) Block

func (p *Proxy) Block(addr string)

func (*Proxy) Start

func (p *Proxy) Start() error

func (*Proxy) Stop

func (p *Proxy) Stop()

func (*Proxy) UnBlock

func (p *Proxy) UnBlock(addr string)

type ProxyConfig

type ProxyConfig struct {
	// The address:port we should bind too
	Listen string
	// The address:port of the upstream udp server we should forward requests too
	Upstream string
	// How long we should wait for a response from the upstream udp server
	UpstreamTimeout time.Duration
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(conf ServerConfig) (*Server, error)

func (*Server) Close

func (u *Server) Close()

type ServerConfig

type ServerConfig struct {
	BindAddress string
	Handler     Handler
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL