diff options
author | Julio Capote <jcapote@gmail.com> | 2023-01-05 13:35:05 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2023-01-05 13:35:05 +0000 |
commit | 5b43c429b91476e7d93d67ddcdd5eb64eea6e892 (patch) | |
tree | 86ad61981d1901cc9f504c04b5e3da91fcf4bde3 | |
parent | c63cd93afff0acd777b8ac5f6b3b2630c3f85d79 (diff) | |
download | communique-5b43c429b91476e7d93d67ddcdd5eb64eea6e892.tar.gz |
add logging
Diffstat (limited to '')
-rw-r--r-- | http/router.go | 2 | ||||
-rw-r--r-- | registry/registry.go | 29 |
2 files changed, 28 insertions, 3 deletions
diff --git a/http/router.go b/http/router.go index fcbd7d2..3b4b1d1 100644 --- a/http/router.go +++ b/http/router.go @@ -86,7 +86,7 @@ func (s *Router) Start(zapWriter io.Writer) { ).With( "payload", payload, - ).Debug("received item") + ).Debug("received inbox item") actorParam := c.Param("actor") err := s.registry.Inbox(actorParam, c.Request, buf.Bytes()) resource := map[string]interface{}{} diff --git a/registry/registry.go b/registry/registry.go index 28871bf..89dd7a1 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -250,8 +250,17 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl *url.URL, follow vocab.Act privKey := &keypair.PrivateKey request, err := http.NewRequest("POST", url.String(), bytes.NewBuffer(jsonData)) + r.log.With( + "type", + "delivery", + ).With( + "payload", + payload, + ).With( + "digest", + request.Header.Get("digest"), + ).Debugf("signing request") - r.log.With("type", "delivery").With("payload", payload).Debugf("signing") r.mu.Lock() defer r.mu.Unlock() prefs := []httpsig.Algorithm{httpsig.RSA_SHA256} @@ -268,7 +277,23 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl *url.URL, follow vocab.Act // If r were a http.ResponseWriter, call SignResponse instead. err = signer.SignRequest(privKey, actorUrl.String(), request, nil) - r.log.With("type", "delivery").With("inbox", url.String()).With("actor", actorUrl.String()).Debugf("sending accept") + r.log.With( + "type", + "delivery", + ).With( + "inbox", + url.String(), + ).With( + "digest", + request.Header.Get("digest"), + ).With( + "signature", + request.Header.Get("signature"), + ).With( + "actor", + actorUrl.String(), + ).Debug("sending signed accept request") + client := &http.Client{} response, err := client.Do(request) if err != nil { |