mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
refactor: change deprecated "io/ioutil" package to recommended "io" package
This commit is contained in:
parent
35984c0876
commit
acce1f1fd9
14 changed files with 25 additions and 39 deletions
|
@ -4,7 +4,6 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
@ -25,7 +24,7 @@ type MockTransport struct {
|
|||
|
||||
// Just returns a response with fake SDP answer.
|
||||
func (m *MockTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
s := ioutil.NopCloser(bytes.NewReader(m.body))
|
||||
s := io.NopCloser(bytes.NewReader(m.body))
|
||||
r := &http.Response{
|
||||
StatusCode: m.statusOverride,
|
||||
Body: s,
|
||||
|
|
|
@ -31,7 +31,6 @@ import (
|
|||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -163,7 +162,7 @@ func genSessionID() string {
|
|||
}
|
||||
|
||||
func limitedRead(r io.Reader, limit int64) ([]byte, error) {
|
||||
p, err := ioutil.ReadAll(&io.LimitedReader{R: r, N: limit + 1})
|
||||
p, err := io.ReadAll(&io.LimitedReader{R: r, N: limit + 1})
|
||||
if err != nil {
|
||||
return p, err
|
||||
} else if int64(len(p)) == limit+1 {
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
|
@ -102,7 +101,7 @@ func main() {
|
|||
SummaryInterval: *summaryInterval,
|
||||
}
|
||||
|
||||
var logOutput = ioutil.Discard
|
||||
var logOutput = io.Discard
|
||||
var eventlogOutput io.Writer = os.Stderr
|
||||
log.SetFlags(log.LstdFlags | log.LUTC)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue