Update to go 1.19

This commit is contained in:
9seconds
2022-08-09 17:41:59 +03:00
parent 9d67414db6
commit f48156814b
60 changed files with 260 additions and 260 deletions
+4 -4
View File
@@ -39,9 +39,9 @@ func (w *wrapperClientAbridged) Read(acks *conntypes.ConnectionAcks) (conntypes.
}
if msgLength == clientAbridgedSmallPacketLength {
buf.Grow(3) // nolint: gomnd
buf.Grow(3) //nolint: gomnd
if _, err := io.CopyN(&buf, w.parent, 3); err != nil { // nolint: gomnd
if _, err := io.CopyN(&buf, w.parent, 3); err != nil { //nolint: gomnd
return nil, fmt.Errorf("cannot read correct message length: %w", err)
}
@@ -75,7 +75,7 @@ func (w *wrapperClientAbridged) Write(packet conntypes.Packet, acks *conntypes.C
return nil
}
packetLength := len(packet) / 4 // nolint: gomnd
packetLength := len(packet) / 4 //nolint: gomnd
switch {
case packetLength < clientAbridgedSmallPacketLength:
@@ -104,7 +104,7 @@ func (w *wrapperClientAbridged) Write(packet conntypes.Packet, acks *conntypes.C
}
func (w *wrapperClientAbridged) Close() error {
return w.parent.Close() // nolint: wrapcheck
return w.parent.Close() //nolint: wrapcheck
}
func (w *wrapperClientAbridged) Conn() net.Conn {
+3 -3
View File
@@ -20,9 +20,9 @@ type wrapperClientIntermediate struct {
func (w *wrapperClientIntermediate) Read(acks *conntypes.ConnectionAcks) (conntypes.Packet, error) {
buf := bytes.Buffer{}
buf.Grow(4) // nolint: gomnd
buf.Grow(4) //nolint: gomnd
if _, err := io.CopyN(&buf, w.parent, 4); err != nil { // nolint: gomnd
if _, err := io.CopyN(&buf, w.parent, 4); err != nil { //nolint: gomnd
return nil, fmt.Errorf("cannot read message length: %w", err)
}
@@ -63,7 +63,7 @@ func (w *wrapperClientIntermediate) Write(packet conntypes.Packet, acks *conntyp
}
func (w *wrapperClientIntermediate) Close() error {
return w.parent.Close() // nolint: wrapcheck
return w.parent.Close() //nolint: wrapcheck
}
func (w *wrapperClientIntermediate) Conn() net.Conn {
@@ -20,7 +20,7 @@ func (w *wrapperClientIntermediateSecure) Read(acks *conntypes.ConnectionAcks) (
return nil, err
}
length := len(data) - (len(data) % 4) // nolint: gomnd
length := len(data) - (len(data) % 4) //nolint: gomnd
return data[:length], nil
}
@@ -35,11 +35,11 @@ func (w *wrapperClientIntermediateSecure) Write(packet conntypes.Packet, acks *c
}
buf := &bytes.Buffer{}
paddingLength := rand.Intn(4) // nolint: gosec, gomnd
paddingLength := rand.Intn(4) //nolint: gosec, gomnd
buf.Grow(4 + len(packet) + paddingLength)
binary.Write(buf, binary.LittleEndian, uint32(len(packet)+paddingLength)) // nolint: errcheck
binary.Write(buf, binary.LittleEndian, uint32(len(packet)+paddingLength)) //nolint: errcheck
buf.Write(packet)
buf.Write(make([]byte, paddingLength))
+2 -2
View File
@@ -42,11 +42,11 @@ func (w *wrapperProxy) Write(packet conntypes.Packet, acks *conntypes.Connection
buf.Write(rpc.ProxyRequestProxyTag)
buf.WriteByte(byte(len(config.C.AdTag)))
buf.Write(config.C.AdTag)
buf.Write(make([]byte, (4-buf.Len()%4)%4)) // nolint: gomnd
buf.Write(make([]byte, (4-buf.Len()%4)%4)) //nolint: gomnd
buf.Grow(len(packet))
buf.Write(packet)
return w.proxy.Write(buf.Bytes()) // nolint: wrapcheck
return w.proxy.Write(buf.Bytes()) //nolint: wrapcheck
}
func (w *wrapperProxy) Read(acks *conntypes.ConnectionAcks) (conntypes.Packet, error) {