sysnet

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sysnet is a point-c network for the host network.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaddyListen

func CaddyListen[T any](ctx context.Context, addr net.Addr) (v T, err error)

CaddyListen helps with listening on an address using Caddy's method. The listener is type asserted to T. An error will be returned if the assertion fails.

Types

type SysDialer

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

SysDialer allows dialing TCP and UDP connections on the system.

func (*SysDialer) Dial

func (s *SysDialer) Dial(ctx context.Context, addr *net.TCPAddr) (net.Conn, error)

Dial dials the given address using TCP.

func (*SysDialer) DialPacket

func (s *SysDialer) DialPacket(addr *net.UDPAddr) (net.PacketConn, error)

DialPacket dials the given address using UDP.

type Sysnet

type Sysnet struct {
	Hostname configvalues.Hostname   `json:"hostname"`
	DialAddr configvalues.ResolvedIP `json:"dial-addr"`
	Local    configvalues.ResolvedIP `json:"local"`
	// contains filtered or unexported fields
}

Sysnet is a point-c network that can dial and listen on the host system.

func (*Sysnet) CaddyModule

func (s *Sysnet) CaddyModule() caddy.ModuleInfo

CaddyModule implements caddy.Module.

func (*Sysnet) Cleanup

func (s *Sysnet) Cleanup() error

Cleanup implements caddy.CleanerUpper.

func (*Sysnet) Dialer

func (s *Sysnet) Dialer(_ net.IP, port uint16) point_c.Dialer

Dialer returns a SysDialer ready to dial on the given address and port.

func (*Sysnet) Listen

func (s *Sysnet) Listen(addr *net.TCPAddr) (net.Listener, error)

Listen listens on the given address using TCP.

func (*Sysnet) ListenPacket

func (s *Sysnet) ListenPacket(addr *net.UDPAddr) (net.PacketConn, error)

ListenPacket listens on the given address using UDP.

func (*Sysnet) LocalAddr

func (s *Sysnet) LocalAddr() net.IP

LocalAddr returns the address this module is configured with.

func (*Sysnet) Provision

func (s *Sysnet) Provision(c caddy.Context) error

Provision implements caddy.Provision.

func (*Sysnet) Start

func (s *Sysnet) Start(fn point_c.RegisterFunc) error

Start implements [Network]. Is registers this module with the given hostname.

func (*Sysnet) UnmarshalCaddyfile

func (s *Sysnet) UnmarshalCaddyfile(d *caddyfile.Dispenser) (err error)

UnmarshalCaddyfile implements [caddyfule.Unmarshaler].

point-c {
  system <network name> <dial ip or hostname> <local ip or hostname>
}

Jump to

Keyboard shortcuts

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