Task chaining + some refactoring

This commit is contained in:
simon987
2019-02-15 22:10:02 -05:00
parent 07c0eca5aa
commit 6ca92bc0a7
31 changed files with 306 additions and 166 deletions

View File

@@ -6,7 +6,6 @@ import (
"crypto/hmac"
"encoding/hex"
"encoding/json"
"fmt"
"github.com/simon987/task_tracker/config"
"github.com/simon987/task_tracker/storage"
"io"
@@ -51,12 +50,10 @@ func Get(path string, worker *storage.Worker) *http.Response {
if worker != nil {
fmt.Println(worker.Secret)
mac := hmac.New(crypto.SHA256.New, worker.Secret)
mac.Write([]byte(path))
sig := hex.EncodeToString(mac.Sum(nil))
fmt.Println(strconv.FormatInt(worker.Id, 10))
req.Header.Add("X-Worker-Id", strconv.FormatInt(worker.Id, 10))
req.Header.Add("X-Signature", sig)
}