iputil

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Need 96 bytes for the largest reject packet:
	// - 20 byte ipv4 header
	// - 8 byte icmpv4 header
	// - 68 byte body (60 byte max orig ipv4 header + 8 byte orig icmpv4 header)
	MaxRejectPacketSize = ipv4.HeaderLen + 8 + 60 + 8
)

Variables

This section is empty.

Functions

func CreateICMPEchoResponse

func CreateICMPEchoResponse(packet, out []byte) []byte

func CreateRejectPacket

func CreateRejectPacket(packet []byte, out []byte) []byte

func ToNetIpAddr

func ToNetIpAddr(ip net.IP) (netip.Addr, error)

func ToNetIpPrefix

func ToNetIpPrefix(ipNet net.IPNet) (netip.Prefix, error)

Types

type VpnIp

type VpnIp uint32

func Ip2VpnIp

func Ip2VpnIp(ip []byte) VpnIp

func (VpnIp) MarshalJSON

func (ip VpnIp) MarshalJSON() ([]byte, error)

func (VpnIp) String

func (ip VpnIp) String() string

func (VpnIp) ToIP

func (ip VpnIp) ToIP() net.IP

func (VpnIp) ToNetIpAddr

func (ip VpnIp) ToNetIpAddr() netip.Addr

Jump to

Keyboard shortcuts

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