summaryrefslogtreecommitdiff
path: root/client/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/client.go')
-rw-r--r--client/client.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/client/client.go b/client/client.go
index e39a6a1..af7c2d8 100644
--- a/client/client.go
+++ b/client/client.go
@@ -1,3 +1,5 @@
+// Package client makes requests to a Caesar Cipher Server in order to encode
+// and decode messages.
package client
import (
@@ -9,14 +11,20 @@ import (
"time"
)
+// A CaesarClient handles communication with a server
type CaesarClient struct {
+ // Endpoint is the URL to which HTTP requests should be made
Endpoint string
- Token string
+
+ // Token is an authorization token to supply to the server
+ Token string
c *http.Client
once sync.Once
}
+// EncodeMessage asks the Caesar server to encode the supplied message and
+// returns the result along with an error in case the request fails.
func (c *CaesarClient) EncodeMessage(r io.Reader) (io.Reader, error) {
c.once.Do(func() {
c.c = &http.Client{Timeout: 10 * time.Second}