goomg

package module
v0.0.0-...-e6b0e8f Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 7 Imported by: 0

README

go-omg

go-omg is an HTTP client and a parser of files specified in Onion Mirror Guidelines. See spec.txt.

Features

  • download and validate /mirrors.txt
  • download and validate /canary.txt
  • download and validate /related.txt

The package intentionally doesn't implement a method to download PGP keys from /pgp.txt. This is to save people from dangerous assumption that verifying signed messages with a key downloaded from the same host, protects them from phishing.

In order to verify signed data, you must trust the key first. To do so, it must be obtained from a trusted source.

Documentation

Index

Constants

View Source
const DefaultUserAgent = "go-omg/1.0"

Variables

This section is empty.

Functions

func NewRequestCanary

func NewRequestCanary(ctx context.Context, hostURL string) (*http.Request, error)

func NewRequestMirrors

func NewRequestMirrors(ctx context.Context, hostURL string) (*http.Request, error)

func NewRequestRelated

func NewRequestRelated(ctx context.Context, hostURL string) (*http.Request, error)

Types

type Client

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

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns an instance of Client, which wraps passed httpClient.

func (Client) GetCanaryMessage

func (c Client) GetCanaryMessage(ctx context.Context, hostURL string) (spec.Canary, error)

GetCanaryMessage makes an HTTP request to a host and downloads contents of canary.txt.

func (Client) GetMirrorsMessage

func (c Client) GetMirrorsMessage(ctx context.Context, hostURL string) (spec.Mirrors, error)

GetMirrorsMessage makes an HTTP request to a host and downloads contents of mirrors.txt.

func (Client) GetRelatedMessage

func (c Client) GetRelatedMessage(ctx context.Context, hostURL string) (spec.Mirrors, error)

GetRelatedMessage makes an HTTP request to a host and downloads contents of related.txt.

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(ua string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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