Compare commits

..

No commits in common. '9d3d523309eae7cbb501b8d17abcb9d5bf49baff' and '2d4867ee39c94032824ae7c18e0314e42020dc2f' have entirely different histories.

@ -4,7 +4,7 @@ import (
"bytes" "bytes"
"context" "context"
"fmt" "fmt"
"io" "io/ioutil"
"net/http" "net/http"
"time" "time"
@ -45,7 +45,7 @@ func (c *httpclient) Exchange(msg *dns.Msg, upstream string) (*dns.Msg, int, err
return nil, 0, fmt.Errorf("http error %d", resp.StatusCode) return nil, 0, fmt.Errorf("http error %d", resp.StatusCode)
} }
data, err = io.ReadAll(resp.Body) data, err = ioutil.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err
} }

@ -1,7 +1,7 @@
package main package main
import ( import (
"os" "io/ioutil"
"github.com/go-yaml/yaml" "github.com/go-yaml/yaml"
) )
@ -21,7 +21,7 @@ type listen struct {
} }
func loadConfig(f string) (*conf, error) { func loadConfig(f string) (*conf, error) {
data, err := os.ReadFile(f) data, err := ioutil.ReadFile(f)
if err != nil { if err != nil {
return nil, err return nil, err
} }

@ -61,7 +61,9 @@ func main() {
makeServers(cfg) makeServers(cfg)
ch := make(chan os.Signal, 2) ch := make(chan os.Signal, 2)
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
s := <-ch select {
case s := <-ch:
log.Errorf("received signal %s, exit...", s) log.Errorf("received signal %s, exit...", s)
}
log.Println("exit.") log.Println("exit.")
} }

@ -1,7 +1,7 @@
package main package main
import ( import (
"io" "io/ioutil"
"net/http" "net/http"
log "github.com/fangdingjun/go-log/v5" log "github.com/fangdingjun/go-log/v5"
@ -26,7 +26,7 @@ func (srv *server) handleHTTPReq(w http.ResponseWriter, r *http.Request) {
return return
} }
data, err := io.ReadAll(r.Body) data, err := ioutil.ReadAll(r.Body)
if err != nil { if err != nil {
log.Errorln("read request body", err) log.Errorln("read request body", err)
http.Error(w, "read request failed", http.StatusBadRequest) http.Error(w, "read request failed", http.StatusBadRequest)

Loading…
Cancel
Save