Move from deprecated ioutil to os and io packages (#744)

This commit is contained in:
KallyDev 2021-09-29 02:49:34 +08:00 committed by GitHub
parent 1ef824c0b4
commit 4abf98c1be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 29 additions and 43 deletions

View file

@ -5,7 +5,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"sync"
@ -315,11 +314,11 @@ func (s *DoHNameServer) dohHTTPSContext(ctx context.Context, b []byte) ([]byte,
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
io.Copy(ioutil.Discard, resp.Body) // flush resp.Body so that the conn is reusable
io.Copy(io.Discard, resp.Body) // flush resp.Body so that the conn is reusable
return nil, fmt.Errorf("DOH server returned code %d", resp.StatusCode)
}
return ioutil.ReadAll(resp.Body)
return io.ReadAll(resp.Body)
}
func (s *DoHNameServer) findIPsForDomain(domain string, option dns_feature.IPOption) ([]net.IP, error) {