aboutsummaryrefslogtreecommitdiff
path: root/doc.go
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2020-11-01 00:05:00 -0400
committerAdnan Maolood <[email protected]>2020-11-01 00:10:30 -0400
commit7fb1b6c6a4759414ac622cf71bf18ab2681de3f5 (patch)
tree9df71ecc232ac069d6cc89127861c8c37f47322b /doc.go
parentRename InsecureTrustAlways to InsecureSkipTrust (diff)
downloadgo-gemini-7fb1b6c6a4759414ac622cf71bf18ab2681de3f5.tar.xz
go-gemini-7fb1b6c6a4759414ac622cf71bf18ab2681de3f5.zip
Update documentationv0.1.4
Diffstat (limited to 'doc.go')
-rw-r--r--doc.go37
1 files changed, 5 insertions, 32 deletions
diff --git a/doc.go b/doc.go
index 0fae695..944adbb 100644
--- a/doc.go
+++ b/doc.go
@@ -7,51 +7,24 @@ Get makes a Gemini request:
if err != nil {
// handle error
}
- // ...
-
-The client must close the response body when finished with it:
-
- resp, err := gemini.Get("gemini://example.com")
- if err != nil {
- // handle error
- }
defer resp.Body.Close()
- body, err := ioutil.ReadAll(resp.Body)
// ...
For control over client behavior, create a Client:
- var client gemini.Client
+ client := &gemini.Client{}
resp, err := client.Get("gemini://example.com")
if err != nil {
// handle error
}
// ...
-Clients can load their own list of known hosts:
-
- err := client.KnownHosts.Load("path/to/my/known_hosts")
- if err != nil {
- // handle error
- }
-
-Clients can control when to trust certificates with TrustCertificate:
-
- client.TrustCertificate = func(hostname string, cert *x509.Certificate) gemini.Trust {
- return gemini.TrustOnce
- }
-
-Clients can create client certificates upon the request of a server:
-
- client.CreateCertificate = func(hostname, path string) (tls.Certificate, error) {
- return gemini.CreateCertificate(gemini.CertificateOptions{
- Duration: time.Hour,
- })
- }
-
Server is a Gemini server.
- var server gemini.Server
+ server := &gemini.Server{
+ ReadTimeout: 10 * time.Second,
+ WriteTimeout: 10 * time.Second,
+ }
Servers should be configured with certificates: