A Client provides access to a Perkeep server. After use, a Client should be closed via its Close method to release idle HTTP connections or other resourcedds.
| 56 | // After use, a Client should be closed via its Close method to |
| 57 | // release idle HTTP connections or other resourcedds. |
| 58 | type Client struct { |
| 59 | // server is the input from user, pre-discovery. |
| 60 | // For example "http://foo.com" or "foo.com:1234". |
| 61 | // It is the responsibility of initPrefix to parse |
| 62 | // server and set prefix, including doing discovery |
| 63 | // to figure out what the proper server-declared |
| 64 | // prefix is. |
| 65 | server string |
| 66 | |
| 67 | prefixOnce syncutil.Once // guards init of following 2 fields |
| 68 | prefixv string // URL prefix before "/camli/" |
| 69 | isSharePrefix bool // URL is a request for a share blob |
| 70 | |
| 71 | discoOnce syncutil.Once |
| 72 | searchRoot string // Handler prefix, or "" if none |
| 73 | downloadHelper string // or "" if none |
| 74 | storageGen string // storage generation, or "" if not reported |
| 75 | hasLegacySHA1 bool // Whether server has SHA-1 blobs indexed. |
| 76 | syncHandlers []*SyncInfo // "from" and "to" url prefix for each syncHandler |
| 77 | serverKeyID string // Server's GPG public key ID. |
| 78 | helpRoot string // Handler prefix, or "" if none |
| 79 | shareRoot string // Share handler prefix, or "" if none |
| 80 | serverPublicKeyBlobRef blob.Ref // Server's public key blobRef |
| 81 | |
| 82 | signerOnce sync.Once |
| 83 | signer *schema.Signer |
| 84 | signerErr error |
| 85 | signHandler string // Handler prefix, or "" if none |
| 86 | |
| 87 | authMode auth.AuthMode |
| 88 | // authErr is set when no auth config is found but we want to defer warning |
| 89 | // until discovery fails. |
| 90 | authErr error |
| 91 | |
| 92 | httpClient *http.Client |
| 93 | haveCache HaveCache |
| 94 | |
| 95 | // If sto is set, it's used before the httpClient or other network operations. |
| 96 | sto blobserver.Storage |
| 97 | |
| 98 | initTrustedCertsOnce sync.Once |
| 99 | |
| 100 | // We define a certificate fingerprint as the 20 digits lowercase prefix |
| 101 | // of the SHA256 of the complete certificate (in ASN.1 DER encoding). |
| 102 | // trustedCerts contains the fingerprints of the self-signed |
| 103 | // certificates we trust. |
| 104 | // If not empty, (and if using TLS) the full x509 verification is |
| 105 | // disabled, and we instead check the server's certificate against |
| 106 | // this list. |
| 107 | // The perkeepd server prints the fingerprint to add to the config |
| 108 | // when starting. |
| 109 | trustedCerts []string |
| 110 | |
| 111 | // insecureAnyTLSCert disables all TLS cert checking, |
| 112 | // including the trustedCerts field above. |
| 113 | insecureAnyTLSCert bool |
| 114 | |
| 115 | initIgnoredFilesOnce sync.Once |
nothing calls this directly
no outgoing calls
no test coverage detected