point_c

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CaddyfilePointCName = "point-c"
	CaddyfileNetOpName  = "netop"
)

Variables

This section is empty.

Functions

This section is empty.

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 Listener

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

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

func (*Listener) Addr

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

func (*Listener) CaddyModule

func (*Listener) CaddyModule() caddy.ModuleInfo

func (*Listener) Close

func (p *Listener) Close() error

func (*Listener) Provision

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

func (*Listener) UnmarshalCaddyfile

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

UnmarshalCaddyfile unmarshals the caddyfile.

	{
	  servers :443 {
	    listener_wrappers {
	      merge {
         # this is the actual listener definition
	        point-c <network name> <port to expose>
	      }
       # make sure tls goes after otherwise encryption will be dropped
	      tls
	    }
	  }
	}

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

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

type Pointc

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

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

func (*Pointc) CaddyModule

func (*Pointc) CaddyModule() caddy.ModuleInfo

func (*Pointc) Cleanup

func (pc *Pointc) Cleanup() error

func (*Pointc) Lookup

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

Lookup gets a Net by its declared name.

func (*Pointc) Provision

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

func (*Pointc) Start

func (pc *Pointc) Start() error

func (*Pointc) Stop

func (pc *Pointc) Stop() error

func (*Pointc) UnmarshalCaddyfile

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

UnmarshalCaddyfile unmarshals a submodules from a caddyfile.

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

type RegisterFunc

type RegisterFunc func(string, Net) error

RegisterFunc registers 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.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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