1
- // The following is copied from Go 1.16 official implementation.
1
+ // The following is copied from Go 1.18 official implementation.
2
2
3
3
// Copyright 2009 The Go Authors. All rights reserved.
4
4
// Use of this source code is governed by a BSD-style
@@ -39,10 +39,10 @@ type Conn interface {
39
39
// Any blocked Read or Write operations will be unblocked and return errors.
40
40
Close () error
41
41
42
- // LocalAddr returns the local network address.
42
+ // LocalAddr returns the local network address, if known .
43
43
LocalAddr () Addr
44
44
45
- // RemoteAddr returns the remote network address.
45
+ // RemoteAddr returns the remote network address, if known .
46
46
RemoteAddr () Addr
47
47
48
48
// SetDeadline sets the read and write deadlines associated
@@ -103,8 +103,12 @@ type Listener interface {
103
103
// An Error represents a network error.
104
104
type Error interface {
105
105
error
106
- Timeout () bool // Is the error a timeout?
107
- Temporary () bool // Is the error temporary?
106
+ Timeout () bool // Is the error a timeout?
107
+
108
+ // Deprecated: Temporary errors are not well-defined.
109
+ // Most "temporary" errors are timeouts, and the few exceptions are surprising.
110
+ // Do not use this method.
111
+ Temporary () bool
108
112
}
109
113
110
114
// OpError is the error type usually returned by functions in the net
@@ -220,6 +224,12 @@ var (
220
224
_ io.Reader = (* Buffers )(nil )
221
225
)
222
226
227
+ // WriteTo writes contents of the buffers to w.
228
+ //
229
+ // WriteTo implements io.WriterTo for Buffers.
230
+ //
231
+ // WriteTo modifies the slice v as well as v[i] for 0 <= i < len(v),
232
+ // but does not modify v[i][j] for any i, j.
223
233
func (v * Buffers ) WriteTo (w io.Writer ) (n int64 , err error ) {
224
234
if wv , ok := w .(buffersWriter ); ok {
225
235
return wv .writeBuffers (v )
@@ -236,6 +246,12 @@ func (v *Buffers) WriteTo(w io.Writer) (n int64, err error) {
236
246
return n , nil
237
247
}
238
248
249
+ // Read from the buffers.
250
+ //
251
+ // Read implements io.Reader for Buffers.
252
+ //
253
+ // Read modifies the slice v as well as v[i] for 0 <= i < len(v),
254
+ // but does not modify v[i][j] for any i, j.
239
255
func (v * Buffers ) Read (p []byte ) (n int , err error ) {
240
256
for len (p ) > 0 && len (* v ) > 0 {
241
257
n0 := copy (p , (* v )[0 ])
0 commit comments