point_c

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package point_c allows Caddy to manage networks.

Index

Constants

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

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 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)
}

NetLookup is implemented by Pointc.

type NetOp

NetOp is implemented by modules in the "point-c.op" namespace.

type Network

Network is implemented by modules in the "point-c.net" namespace.

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

CaddyModule implements caddy.Module.

func (*Pointc) Cleanup

func (pc *Pointc) Cleanup() error

Cleanup implements caddy.CleanerUpper.

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

Provision implements caddy.Provisioner.

func (*Pointc) Register

func (pc *Pointc) Register(key string, n Net) error

Register adds a new network to the Pointc instance. The 'key' parameter is a unique identifier for the network. On success, the network is registered with the Pointc instance.

func (*Pointc) Start

func (pc *Pointc) Start() error

Start implements caddy.App.

func (*Pointc) Stop

func (pc *Pointc) Stop() error

Stop implements caddy.App.

func (*Pointc) UnmarshalCaddyfile

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

UnmarshalCaddyfile unmarshals a submodules from a caddyfile. The `netops` modifier causes the modules to be loaded as netops.

 ```
	{
	  point-c [netops] {
	    <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 also helps with configuration, so that users don't need to remember ip addresses.

Jump to

Keyboard shortcuts

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