Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotDirectory returned by ReadDir if we try to read non-directory path ErrNotDirectory = fmt.Errorf("not a directory") // ErrNotFile returned by ReadFile if we try to read non-file path ErrNotFile = fmt.Errorf("not a file") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { ClientParams // contains filtered or unexported fields }
func (*Client) ResolveLicense ¶
func (c *Client) ResolveLicense(ctx context.Context, m validation.Module) (validation.License, error)
ResolveLicense attempts to resolve license using project zip file. Content-Type must be application/zip otherwise InvalidContentTypeErr error returned. It uses http range requests to not fully download file when server supports it.
type ClientParams ¶
type ClientParams struct { HTTPClient *http.Client // BaseURL is a proxy base url (i.e. https://proxy.golang.org) BaseURL string // StoreMemLimit is a limit for in-memory zip storage when server not supports http range requests // By default it's 1MiB StoreMemLimit int64 // StoreFileLimit is a limit for file-based zip storage when server not supports http range requests // By default it's 1GiB StoreFileLimit int64 // ConfidenceThreshold is a lower bound threshold of license matching confidence ConfidenceThreshold float64 }
type InvalidContentTypeErr ¶
type InvalidContentTypeErr string
func (InvalidContentTypeErr) Error ¶
func (e InvalidContentTypeErr) Error() string
type ZipFiler ¶
type ZipFiler struct { *zip.Reader // Module archives contains project root inside path "<module name>@<module version>" // So for correct license recognition we should trim this prefix from all paths validation.Module // contains filtered or unexported fields }
ZipFiler is an implementation of filesystem for src-d license scanner based on zip archive
func (*ZipFiler) PathsAreAlwaysSlash ¶
Click to show internal directories.
Click to hide internal directories.