certspotter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BaseURL is the base url for certspotter API endpoint.
	BaseURL = "https://api.certspotter.com/v1"
)
View Source
var (
	// ErrUnexpectedStatus is returned for status codes other than 2XX
	ErrUnexpectedStatus = errors.New("unexpected status")
)

Functions

func CheckResponse

func CheckResponse(resp *http.Response) error

CheckResponse returns an error if http.Response was unsuccessful.

Types

type Certificate

type Certificate struct {
	Data   string `json:"data"`
	SHA256 string `json:"sha256"`
	Type   string `json:"type"`
}

Certificate represents a cerspotter certificate object.

type Client

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

Client is a certspotter API client.

func NewClient

func NewClient(cfg *Config) *Client

NewClient returns a new certspotter API client.

func (*Client) Do

func (c *Client) Do(ctx context.Context, val interface{}, opts *DoOptions) (*http.Response, error)

Do sends a request with options to certspotter api and encodes json response into val.

func (*Client) GetIssuances

func (c *Client) GetIssuances(ctx context.Context, opts *GetIssuancesOptions) ([]*Issuance, *http.Response, error)

GetIssuances returns issuances and response for options.

func (*Client) GetURL

func (c *Client) GetURL(path string, params interface{}) (string, error)

GetURL returns a url string for path and parameters or errors.

type Config

type Config struct {
	Token     string
	UserAgent string
}

Config is used for configuring the client.

type DoOptions

type DoOptions struct {
	Method     string
	Path       string
	Parameters interface{}
}

DoOptions are options used when doing a request.

type GetIssuancesOptions

type GetIssuancesOptions struct {
	Domain            string   `url:"domain"`
	IncludeSubdomains bool     `url:"include_subdomains,omitempty"`
	MatchWildcards    bool     `url:"match_wildcards,omitempty"`
	After             string   `url:"after,omitempty"`
	Expand            []string `url:"expand,omitempty"`
}

GetIssuancesOptions are options used when getting issuances.

type Issuance

type Issuance struct {
	ID        string   `json:"id"`
	DNSNames  []string `json:"dns_names"`
	TBSSHA256 string   `json:"tbs_sha256"`

	NotBefore    time.Time `json:"not_before"`
	NotAfter     time.Time `json:"not_after"`
	PubKeySHA256 string    `json:"pubkey_sha256"`

	Issuer      *Issuer      `json:"issuer"`
	Certificate *Certificate `json:"cert"`
}

Issuance represents a cerspotter issuance object.

type Issuances

type Issuances []*Issuance

Issuances implements sort.Interface.

func (Issuances) Len

func (is Issuances) Len() int

Len, Swap, Less implement sort.Interface

func (Issuances) Less

func (is Issuances) Less(i, j int) bool

func (Issuances) Swap

func (is Issuances) Swap(i, j int)

type Issuer

type Issuer struct {
	Name         string `json:"name"`
	PubKeySHA256 string `json:"pubkey_sha256"`
}

Issuer represents a cerspotter issuer object.

Jump to

Keyboard shortcuts

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