net

package module
v0.45.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

net/http/auth

Create BasicAuthHandler and populate with BasicAuthMap

var handler http.Handler

server := dch.NewServerWithLogger(serverConfig, logger)

authMap := dca.BasicAuthMap{}
authMap.AddUserWithPlainPassword("userA", "passwordA")

server.AddHandler("/status", dca.NewBasicAuthHandler(handler, authMap))

```§

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IPv4ICanHazIP = "http://ipv4.icanhazip.com"
	IPv6ICanHazIP = "http://ipv6.icanhazip.com"
)

Functions

func AddrPortDetailsFromString

func AddrPortDetailsFromString(addrPort string) (netip.AddrPort, string, error)

func ConvertAddrToIP

func ConvertAddrToIP(addr netip.Addr) net.IP

func ExpandStringTemplate

func ExpandStringTemplate(templateString string, data any) (string, error)

func FindInterfaceForAddr

func FindInterfaceForAddr(a netip.Addr) (string, error)

func FindInterfaceForIP

func FindInterfaceForIP(ip net.IP) (string, error)

func GetMyIPs added in v0.45.1

func GetMyIPs(ctx context.Context) ([]netip.Addr, error)

GetMyIP fetches the public IP address of the host.

func GetMyIPv4 added in v0.45.1

func GetMyIPv4(ctx context.Context) (netip.Addr, error)

GetIPv4 fetches the public IPv4 address of the host.

func GetMyIPv6 added in v0.45.1

func GetMyIPv6(ctx context.Context) (netip.Addr, error)

GetIPv6 fetches the public IPv6 address of the host.

func TCPAddrFromURL

func TCPAddrFromURL(url *url.URL) (string, error)

func TCPPortFromURL

func TCPPortFromURL(url *url.URL) (string, error)

returns string because that's what url.URL.Port() does

Types

type DoneConn added in v0.44.0

type DoneConn interface {
	net.Conn
	RawConn
	Done() <-chan struct{}
	Closed() bool
}

func NewConnWithCloser

func NewConnWithCloser(c net.Conn, closer func(net.Conn)) DoneConn

func NewDoneConn added in v0.44.0

func NewDoneConn(c net.Conn) DoneConn

type RawConn added in v0.44.0

type RawConn interface {
	NetConn() net.Conn
}

Jump to

Keyboard shortcuts

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