Documentation
¶
Overview ¶
Package upload sends a file to the place a CSMS names in GetDiagnostics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Schemes = []string{"http", "https", "ftp", "ftps", "sftp"}
Schemes lists the kinds of location Send can upload to.
Functions ¶
func Send ¶
Send uploads data as a file called name to the directory at location: with PUT for http and https, with STOR for ftp and ftps, and over SSH for sftp. A user name and a password in the location are used to log in. The policy says which machines may be connected to; an upload it stops fails with a *RefusedError.
Types ¶
type Policy ¶ added in v0.1.4
type Policy struct {
// CSMS is the address the charger reaches its CSMS at. The zero value
// means it is not known, and then only allowed hosts can be reached.
CSMS netip.Addr
// Allow lists further hosts, by name or by address, as they are
// written in a location.
Allow []string
// InsecureSkipVerify turns off the check of the certificate an https
// or ftps server shows, for servers with a self-signed one.
InsecureSkipVerify bool
// Notice, if set, is told what is worth a line in the charger's log
// about an upload that goes ahead.
Notice func(text string)
}
Policy says where a charger may upload to. The CSMS chooses the location of an upload, so without a limit a hostile or compromised CSMS could make the machine plugyard runs on connect to any address that machine can reach, such as the internal services of a network.
A charger may always upload to the machine its CSMS is on, which gives the CSMS no reach it did not have. Any other host has to be allowed.
type RefusedError ¶ added in v0.1.4
type RefusedError struct {
// Host is the host as the location names it, and Addr the address it
// stands for.
Host string
Addr netip.Addr
// Never is set for an address no setting can allow.
Never bool
}
RefusedError says an upload was not made because of where it would go.
func (*RefusedError) Error ¶ added in v0.1.4
func (e *RefusedError) Error() string