url

package
v0.0.0-...-6ac2e72 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPrefixURLMapFromUrlResponses

func GetPrefixURLMapFromUrlResponses(responses *[]UrlResponse) (prefixesWithPaths map[netip.Prefix][]string, err error)

func ReadRawPrefixesFromFileData

func ReadRawPrefixesFromFileData(data []byte) (ipnets []netip.Prefix, err error)

ReadRawPrefixesFromFileData reads the IPs as strings from the given path

func ReadRawPrefixesFromUrlResponse

func ReadRawPrefixesFromUrlResponse(response UrlResponse) (prefixes []netip.Prefix, err error)

Types

type Client

type Client struct {
	Debug bool
	// URLs       []url.URL
	HttpClient *retryablehttp.Client
}

func New

func New(opt ...Option) *Client

func (*Client) FetchPrefixes

func (c *Client) FetchPrefixes(requests []Request) (prefixes map[netip.Prefix][]string, err error)

func (*Client) FetchPrefixesAsText

func (c *Client) FetchPrefixesAsText(requests []Request) (prefixes []string, err error)

func (*Client) Get

func (c *Client) Get(requests []Request) (*[]UrlResponse, error)

type DataMap

type DataMap map[string][]string

type Doc

type Doc struct {
	SyncToken    string
	CreationTime time.Time
	IPv4Prefixes []IPv4Entry
	IPv6Prefixes []IPv6Entry
}

type GetInput

type GetInput struct {
	Url    url.URL
	Header http.Header
}

type HttpFile

type HttpFile struct {
	Client *retryablehttp.Client
	Url    string
	Debug  bool
}

func (*HttpFile) FetchPrefixes

func (hf *HttpFile) FetchPrefixes() (prefixes []netip.Prefix, err error)

func (*HttpFile) FetchUrl

func (hf *HttpFile) FetchUrl() (result UrlResponse, err error)

type HttpFiles

type HttpFiles struct {
	Client *retryablehttp.Client
	Urls   []string
	Debug  bool
}

func NewList

func NewList() HttpFiles

func (*HttpFiles) Add

func (hf *HttpFiles) Add(urls []string)

func (*HttpFiles) FetchUrls

func (hf *HttpFiles) FetchUrls() (results []UrlResponse, err error)

type IPv4Entry

type IPv4Entry struct {
	IPv4Prefix netip.Prefix `json:"ipv4Prefix"`
	Service    string       `json:"service"`
	Scope      string       `json:"scope"`
}

type IPv6Entry

type IPv6Entry struct {
	IPv6Prefix netip.Prefix `json:"ipv6Prefix"`
	Service    string       `json:"service"`
	Scope      string       `json:"scope"`
}

type Option

type Option func(*Client)

func WithHttpClient

func WithHttpClient(rc *retryablehttp.Client) Option

type PrefixesWithPaths

type PrefixesWithPaths map[netip.Prefix][]string

type RawDoc

type RawDoc struct {
	SyncToken     string `json:"syncToken"`
	CreationTime  string `json:"creationTime"`
	LastRequested time.Time
	Entries       []json.RawMessage `json:"prefixes"`
}

type RawIPv4Entry

type RawIPv4Entry struct {
	IPv4Prefix string `json:"ipv4Prefix"`
	Service    string `json:"service"`
	Scope      string `json:"scope"`
}

type RawIPv6Entry

type RawIPv6Entry struct {
	IPv6Prefix string `json:"ipv6Prefix"`
	Service    string `json:"service"`
	Scope      string `json:"scope"`
}

type Request

type Request struct {
	Method string
	Url    *url.URL
	Header http.Header
}

type Responses

type Responses []UrlResponse

type UrlResponse

type UrlResponse struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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