This commit is contained in:
crusader 2018-06-20 16:02:23 +09:00
parent 5c79b397ea
commit b4974183c6
2 changed files with 10 additions and 9 deletions

4
Gopkg.lock generated
View File

@ -86,7 +86,7 @@
"model/sensorconfig",
"service/probe"
]
revision = "fc4a5e60d0579e7ea1ba316551237143c72b9019"
revision = "f64ffa19c31f7b997fdd9d2875f83b0cae176ac2"
[[projects]]
name = "github.com/BurntSushi/toml"
@ -188,7 +188,7 @@
"unix",
"windows"
]
revision = "8883426083c04a2627e6e59d84d5f6fb63d16c91"
revision = "fc8bd948cf46f9c7af0f07d34151ce25fe90e477"
[[projects]]
name = "gopkg.in/yaml.v2"

View File

@ -5,7 +5,6 @@ import (
"compress/gzip"
"encoding/base64"
"encoding/json"
"log"
"net"
cun "git.loafle.net/commons/util-go/net"
@ -38,21 +37,23 @@ func GetRegistHeader(apiKey string) (string, error) {
}
var b bytes.Buffer
gz := gzip.NewWriter(&b)
if _, err := gz.Write(buf); err != nil {
gWriter, err := gzip.NewWriterLevel(&b, gzip.BestSpeed)
if nil != err {
return "", err
}
if err := gz.Flush(); err != nil {
if _, err := gWriter.Write(buf); nil != err {
return "", err
}
if err := gz.Close(); err != nil {
if err := gWriter.Flush(); nil != err {
return "", err
}
if err := gWriter.Close(); nil != err {
return "", err
}
gBuf := b.Bytes()
log.Printf("RegistHeader length: %d", len(gBuf))
enc := base64.StdEncoding.EncodeToString(gBuf)
return enc, nil