utils

package
v0.0.0-...-a8e6978 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const PipeBufferSize = 32 * 1024

Variables

This section is empty.

Functions

func NewKeypairLoader

func NewKeypairLoader(certPath, keyPath string) (*keypairLoader, error)

func ParseIPZone

func ParseIPZone(s string) (net.IP, string)

func Pipe

func Pipe(src, dst io.ReadWriter, count func(int)) error

func Pipe2Way

func Pipe2Way(rw1, rw2 io.ReadWriter, count func(int)) error

count: positive numbers for rw1 to rw2, negative numbers for rw2 to re1

func PipePairWithTimeout

func PipePairWithTimeout(conn net.Conn, stream io.ReadWriteCloser, timeout time.Duration) error

func SplitHostPort

func SplitHostPort(hostport string) (string, uint16, error)

Types

type IpMasker

type IpMasker struct {
	IPv4Mask net.IPMask
	IPv6Mask net.IPMask
}

func (*IpMasker) Mask

func (m *IpMasker) Mask(addr string) string

Mask masks an address with the configured CIDR. addr can be "host:port" or just host.

Jump to

Keyboard shortcuts

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