point_c

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 18 Imported by: 1

README

  • Handle requesting 127.0.0.1
  • Proxy handler module

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StubListener added in v0.0.10

func StubListener(_ context.Context, _, addr string, _ net.ListenConfig) (any, error)

StubListener creates a stub network listener. This listener does not accept actual network connections but instead blocks on Accept calls until Close is called. It can be used as a base listener when only tunnel listeners are required.

Types

type Dialer

type Dialer interface {
	// Dial dials a remote address with the TCP protocol.
	Dial(context.Context, *net.TCPAddr) (net.Conn, error)
	// DialPacket dials a remote address with the UDP protocol.
	DialPacket(*net.UDPAddr) (net.PacketConn, error)
}

type Forward added in v0.0.10

type Forward struct {
	Name  configvalues.Hostname
	Ports []*configvalues.CaddyTextUnmarshaler[*PortPair, PortPair, *PortPair]
}

type Forwarder added in v0.0.10

type Forwarder struct {
	Net  Net
	Dst  uint16
	Addr caddy.NetworkAddress
	Ctx  caddy.Context
}

type Forwards added in v0.0.10

type Forwards struct {
	Forwards []*Forward `json:"forwards,omitempty"`
	// contains filtered or unexported fields
}

func (*Forwards) CaddyModule added in v0.0.10

func (*Forwards) CaddyModule() caddy.ModuleInfo

func (*Forwards) Cleanup added in v0.0.10

func (p *Forwards) Cleanup() error

func (*Forwards) Provision added in v0.0.10

func (p *Forwards) Provision(ctx caddy.Context) error

func (*Forwards) Start added in v0.0.10

func (p *Forwards) Start() error

func (*Forwards) Stop added in v0.0.10

func (p *Forwards) Stop() error

func (*Forwards) UnmarshalCaddyfile added in v0.0.10

func (p *Forwards) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile unmarshals a submodules from a caddyfile.

{
  forward <net name> {
    [<host>:]<src>:<dst>[/<tcp|udp>]
  }
}

type Listener added in v0.0.10

type Listener struct {
	Name configvalues.Hostname `json:"name"`
	Port configvalues.Port     `json:"port"`
	// contains filtered or unexported fields
}

Listener allows a caddy server to listen on a point-c network.

func (*Listener) Accept added in v0.0.10

func (p *Listener) Accept() (net.Conn, error)

func (*Listener) Addr added in v0.0.10

func (p *Listener) Addr() net.Addr

func (*Listener) CaddyModule added in v0.0.10

func (*Listener) CaddyModule() caddy.ModuleInfo

func (*Listener) Close added in v0.0.10

func (p *Listener) Close() error

func (*Listener) Provision added in v0.0.10

func (p *Listener) Provision(ctx caddy.Context) error

func (*Listener) UnmarshalCaddyfile added in v0.0.10

func (p *Listener) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile unmarshals the caddyfile.

{
  servers :443 {
    listener_wrappers {
      merge {
        point-c <network name> <port to expose>
      }
      tls
    }
  }
}

type MultiWrapper added in v0.0.10

type MultiWrapper struct {
	// ListenerRaw is a slice of JSON-encoded data representing listener configurations.
	// These configurations are used to create the actual net.Listener instances.
	// Listeners should implement [net.Listener] and be in the 'caddy.listeners.multi.listeners' namespace.
	ListenerRaw []json.RawMessage `json:"listeners" caddy:"namespace=caddy.listeners.multi.listeners inline_key=listener"`
	// contains filtered or unexported fields
}

MultiWrapper loads multiple [net.Listener]s and aggregates their [net.Conn]s into a single net.Listener. It allows caddy to accept connections from multiple sources.

func (*MultiWrapper) CaddyModule added in v0.0.10

func (p *MultiWrapper) CaddyModule() caddy.ModuleInfo

CaddyModule implements caddy.Module.

func (*MultiWrapper) Cleanup added in v0.0.10

func (p *MultiWrapper) Cleanup() (err error)

Cleanup implements caddy.CleanerUpper. All wrapped listeners are closed and the struct is cleared.

func (*MultiWrapper) Provision added in v0.0.10

func (p *MultiWrapper) Provision(ctx caddy.Context) error

Provision implements caddy.Provisioner. It loads the listeners from their configs and asserts them to net.Listener. Any failed assertions will cause a panic.

func (*MultiWrapper) UnmarshalCaddyfile added in v0.0.10

func (p *MultiWrapper) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler. Must have at least one listener to aggregate with the wrapped listener. `tls` should come specifically after any `multi` directives.

 http caddyfile:
	{
	  servers :443 {
	    listener_wrappers {
	      multi {
	        <submodule name> <submodule config>
	      }
	      tls
	    }
	  }
	}

func (*MultiWrapper) WrapListener added in v0.0.10

func (p *MultiWrapper) WrapListener(ls net.Listener) net.Listener

WrapListener implements caddy.ListenerWrapper. The listener passed in is closed by MultiWrapper during cleanup.

type Net

type Net interface {
	// Listen listens on the given address with the TCP protocol.
	Listen(addr *net.TCPAddr) (net.Listener, error)
	// ListenPacket listens on the given address with the UDP protocol.
	ListenPacket(addr *net.UDPAddr) (net.PacketConn, error)
	// Dialer returns a [Dialer] with a given local address. If the network does not support arbitrary remote addresses this value can be ignored.
	Dialer(laddr net.IP, port uint16) Dialer
	// LocalAddr is the local address of the net interface. If it does not have one, return nil.
	LocalAddr() net.IP
}

Net is a peer in the networking stack. If it has a local address [Net.LocalAddress] should return a non-nil value.

type NetLookup added in v0.0.10

type NetLookup interface {
	Lookup(string) (Net, bool)
}

type Network added in v0.0.10

type Network interface {
	Networks() map[string]Net
}

Network is a map of a unique name to a Net tunnel. Since ip addresses may be arbitrary depending on what the application is doing in the tunnel, names are used as lookup. This allows helps with configuration, so that users don't need to remember ip addresses.

type Pointc added in v0.0.10

type Pointc struct {
	NetworksRaw []json.RawMessage `json:"networks,omitempty" caddy:"namespace=point-c.net inline_key=type"`
	// contains filtered or unexported fields
}

Pointc allows usage of networks through a net-ish interface.

func (*Pointc) CaddyModule added in v0.0.10

func (*Pointc) CaddyModule() caddy.ModuleInfo

func (*Pointc) Lookup added in v0.0.10

func (wg *Pointc) Lookup(name string) (Net, bool)

Lookup gets a Net by its declared name.

func (*Pointc) Provision added in v0.0.10

func (wg *Pointc) Provision(ctx caddy.Context) error

func (*Pointc) Start added in v0.0.10

func (*Pointc) Start() error

func (*Pointc) Stop added in v0.0.10

func (*Pointc) Stop() error

func (*Pointc) UnmarshalCaddyfile added in v0.0.10

func (wg *Pointc) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile unmarshals a submodules from a caddyfile.

{
  point-c {
    <submodule name> <submodule config>
  }
}

type PortPair added in v0.0.10

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

PortPair is a [<host>:]<src>:<dst>[/<tcp|udp>] port pair.

func (*PortPair) Dst added in v0.0.10

func (pp *PortPair) Dst() uint16

func (*PortPair) Host added in v0.0.10

func (pp *PortPair) Host() (net.IP, bool)

func (*PortPair) IsUDP added in v0.0.10

func (pp *PortPair) IsUDP() bool

func (*PortPair) Src added in v0.0.10

func (pp *PortPair) Src() uint16

func (*PortPair) UnmarshalText added in v0.0.10

func (pp *PortPair) UnmarshalText(b []byte) error

func (*PortPair) Value added in v0.0.10

func (pp *PortPair) Value() *PortPair

Directories

Path Synopsis
internal
networks/wg Module
pkg
wg Module
wglog
wgevents Module

Jump to

Keyboard shortcuts

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