ipwhoisserver

package
v0.0.0-...-a2ee498 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, reqs <-chan *Query)

Serve execute Queries and provide their answer as channel-in-channel. Cancel the given context to stop the clockwork. Use NewQuery to create the requests in a way to avoid goroutine leaks. The internal cache table evicts entries older than 12h.

Types

type Query

type Query struct {
	IP       string
	Response chan *Response
}

Query holds what's the target that the ipwhoisserver should investigate for country ownership.

func NewQuery

func NewQuery(ip string) *Query

NewQuery creates the query that the server can use to execute queries and not leak goroutines.

type Response

type Response struct {
	Country string
	Err     error
	Cached  bool
}

Response to a Query asking what country is owner of a given IP.

Jump to

Keyboard shortcuts

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