Skip to content

Commit

Permalink
fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
AZ-X committed May 15, 2021
1 parent 1656148 commit c017b18
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions repique/configuration/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"hash"
"io"
"io/ioutil"
"net/url"
"os"
"strings"
Expand Down Expand Up @@ -48,11 +49,11 @@ func (source *Source) checkSignature(bin, sig []byte) (err error) {

func (source *Source) ReadFile(now time.Time, hasher hash.Hash) (delay time.Duration, err error, in []byte) {
var bin, sig []byte
if bin, err = os.ReadFile(source.cacheFile); err != nil {
if bin, err = ioutil.ReadFile(source.cacheFile); err != nil {
return
}
io.Copy(hasher, bytes.NewReader(bin))
if sig, err = os.ReadFile(source.cacheFile + ".minisig"); err != nil {
if sig, err = ioutil.ReadFile(source.cacheFile + ".minisig"); err != nil {
return
}
if err = source.checkSignature(bin, sig); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions repique/features/dns/nodes/materials.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"bytes"
"fmt"
"io"
"os"
"io/ioutil"
"strings"
"time"

Expand Down Expand Up @@ -57,7 +57,7 @@ func (m *materials) open(path string, identity []byte) {
m.path = path
m.identity = identity
m.values = make(map[string]*struct{c uint8; v string})
if bin, err := os.ReadFile(path); err == nil {
if bin, err := ioutil.ReadFile(path); err == nil {
r := bufio.NewReaderSize(bytes.NewReader(bin), len(bin))
var identity1 []byte
if _, err = fmt.Fscanf(r, identityfmt, &identity1); err == nil {
Expand Down Expand Up @@ -115,5 +115,5 @@ func (m *materials) savepoint() {
fmt.Fprintf(&content, keyfmt, key, item.c)
content.WriteString(item.v)
}
os.WriteFile(m.path, []byte(content.String()), 0600)
ioutil.WriteFile(m.path, []byte(content.String()), 0600)
}
5 changes: 3 additions & 2 deletions repique/protocols/tls/ztransport.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/base64"
"errors"
"io"
"io/ioutil"
"net"
"net/http"
"net/url"
Expand Down Expand Up @@ -438,7 +439,7 @@ Go:
req = req.WithContext(ctx)
if method == POST && body != nil {
req.ContentLength = int64(len(*body))
req.Body = io.NopCloser(bytes.NewReader(*body))
req.Body = ioutil.NopCloser(bytes.NewReader(*body))
}
resp, err := client.Do(req)
if err != nil {
Expand Down Expand Up @@ -472,7 +473,7 @@ Go:
if resp.ContentLength > 0 {
size = common.Min64(resp.ContentLength, size)
}
bin, err := io.ReadAll(io.LimitReader(resp.Body, size))
bin, err := ioutil.ReadAll(io.LimitReader(resp.Body, size))
if err != nil {
goto Error
}
Expand Down

0 comments on commit c017b18

Please sign in to comment.