jmc

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 3 Imported by: 0

README

jmc-go

IP Address determination for japanese mobile careers

usage

import (
	"fmt"

	"github.com/chromsh/jmc-go"
)

func main() {
	career, ok := jmc.DetectCareer("203.138.180.0")
	if ok {
		fmt.Println(career)
	}
}

benchmark

  • DetectCareer
$ go test -benchmem -run=^$ -bench ^BenchmarkDetectCareer$ github.com/chromsh/jmc-go -count=1 -cpu=1
goos: linux
goarch: amd64
pkg: github.com/chromsh/jmc-go
cpu: AMD Ryzen 7 3700X 8-Core Processor
BenchmarkDetectCareer      93481             12863 ns/op            1601 B/op         40 allocs/op
PASS
ok      github.com/chromsh/jmc-go       1.371s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Career

type Career string
const (
	CareerDocomo   Career = "docomo"
	CareerAU       Career = "au"
	CareerSoftbank Career = "softbank"
	CareerRakuten  Career = "rakuten"
	CareerUnknown  Career = "unknown"
)

func DetectCareer

func DetectCareer(ip string) (Career, bool)

DetectCareer returns career name of IP address. Returns true if the IP address is within range of one of the carriers.

func (Career) String

func (c Career) String() string

Jump to

Keyboard shortcuts

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