diff options
| author | Adnan Maolood <[email protected]> | 2021-02-18 00:37:56 -0500 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2021-02-18 00:38:03 -0500 |
| commit | a80aae44a9d5246b63fb92b3c843431697217e4e (patch) | |
| tree | e2a5bcb24154dd887df79909f90e087fdd98f1eb /doc.go | |
| parent | response: Implement Write method (diff) | |
| download | go-gemini-a80aae44a9d5246b63fb92b3c843431697217e4e.tar.xz go-gemini-a80aae44a9d5246b63fb92b3c843431697217e4e.zip | |
doc: Update package documentation
Diffstat (limited to 'doc.go')
| -rw-r--r-- | doc.go | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -1,5 +1,5 @@ /* -Package gemini implements the Gemini protocol. +Package gemini provides Gemini client and server implementations. Client is a Gemini client. @@ -25,17 +25,20 @@ Servers should be configured with certificates: // handle error } -Servers can accept requests for multiple hosts and schemes: +ServeMux is a Gemini request multiplexer. +ServeMux can handle requests for multiple hosts and schemes. - server.RegisterFunc("example.com", func(w gemini.ResponseWriter, r *gemini.Request) { + mux := &gemini.ServeMux{} + mux.HandleFunc("example.com", func(w gemini.ResponseWriter, r *gemini.Request) { fmt.Fprint(w, "Welcome to example.com") }) - server.RegisterFunc("example.org", func(w gemini.ResponseWriter, r *gemini.Request) { - fmt.Fprint(w, "Welcome to example.org") + mux.HandleFunc("example.org/about.gmi", func(w gemini.ResponseWriter, r *gemini.Request) { + fmt.Fprint(w, "About example.org") }) - server.RegisterFunc("http://example.net", func(w gemini.ResponseWriter, r *gemini.Request) { + mux.HandleFunc("http://example.net", func(w gemini.ResponseWriter, r *gemini.Request) { fmt.Fprint(w, "Proxied content from http://example.net") }) + server.Handler = mux To start the server, call ListenAndServe: |