ipconv

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

gonetx/ipconv

ipconv is a package providing utility functions to convert ip with high performance.

Benchmark

Here is the benchmark with 2.4 GHz 8-Core Intel Core i9:

$ GOMAXPROCS=1 go test -bench='Ipconv' -benchmem -benchtime=10s 
Benchmark_Ipconv_V42Long        604734988               18.5 ns/op             0 B/op          0 allocs/op
Benchmark_Ipconv_Long2V4        803246886               15.0 ns/op             0 B/op          0 allocs/op

Documentation

Overview

Package ipconv is a library providing utility functions to convert ip.

Index

Constants

View Source
const Version = "0.1.1"

Version of current package

Variables

This section is empty.

Functions

func Long2V4

func Long2V4(ip uint32) string

Long2V4 convert an uint32 integer to ipv4 string

func SafeV42Long

func SafeV42Long(ip string) (long uint32, err error)

SafeV42Long converts an ipv4 string to an uint32 integer. An error returns if format of ip is not ipv4

func V42Long

func V42Long(ip string) uint32

V42Long converts an ipv4 string to an uint32 integer. Panic if format of ip is not ipv4

Types

This section is empty.

Jump to

Keyboard shortcuts

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