mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 09:18:34 +00:00
Move from deprecated ioutil to os and io packages (#744)
This commit is contained in:
parent
1ef824c0b4
commit
4abf98c1be
17 changed files with 29 additions and 43 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue