Skip to content

fsuhrau/anonymizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

anonymizer

Golang anonymizer for ip addresses.

You can use it to anonymize your logs.

Use it at your own risk i will not give any legal correctness.

usage

install

go get github.com/fsuhrau/anonymizer

example

Try it out in Go Playground

package main

import (
	"fmt"
	"net"
	"github.com/fsuhrau/anonymizer"
)

func main() {
	ipV4 := "192.168.0.12"
	out := anonymizer.AnonymizeIP(ipV4)
	// prints out 192.168.0.0
	fmt.Println(out)

	ipV6 := "2001:db8:85a3:8d3:1319:8a2e:370:7348"
	out = anonymizer.AnonymizeIP(ipV6)
	// prints out 2001:db8:85a3:8d3:
	fmt.Println(out)
    
	netIP := net.ParseIP("216.58.207.67")
	out = anonymizer.AnonymizeNetIP(netIP)
	// prints out 216.58.207.0
	fmt.Println(out)
}

About

Golang anonymizer for ip addresses

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages