prefix-fetcher

module
v0.0.0-...-ca3e714 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT

README

prefix-fetcher

GoDoc Go Report Card

about

prefix-fetcher is a go library and cli used to retrieve public ip prefixes from popular cloud and hosting providers.
Please raise an issue if you have any issues or suggestions for new providers.

supported providers

CLI

install

Download the latest release here and then install:

install <prefix-fetcher binary> /usr/local/bin/prefix-fetcher

use: sudo install if on linux

run
prefix-fetcher <provider> <options>

for example:

  • output aws prefixes to the console: prefix-fetcher aws --stdout
  • save gcp prefixes to a file: prefix-fetcher gcp --file prefixes.json

API

The following example uses the GCP (Google Cloud Platform) provider.

installation
go get github.com/jonhadfield/prefix-fetcher/gcp
basic usage
package main

import (
	"fmt"
	"github.com/jonhadfield/prefix-fetcher/gcp"
)

func main() {
	g := gcp.New() // initialise client
	doc, err := g.Fetch() // fetch prefixes document
	if err != nil {
		panic(err)
	}

	for _, p := range doc.IPv6Prefixes {
		fmt.Printf("%s %s %s\n", p.IPv6Prefix.String(), p.Service, p.Scope)
	}
}

Directories

Path Synopsis
cmd
prefix-fetcher command
internal
web
maxmind

Jump to

Keyboard shortcuts

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