mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 20:24:03 +03:00
Update to go 1.19
This commit is contained in:
+1
-1
@@ -51,7 +51,7 @@ func doRPCNonceRequest(conn conntypes.BasePacketWriter) (*rpc.NonceRequest, erro
|
||||
}
|
||||
|
||||
if err := conn.Write(rpcNonceReq.Bytes()); err != nil {
|
||||
return nil, err // nolint: wrapcheck
|
||||
return nil, err //nolint: wrapcheck
|
||||
}
|
||||
|
||||
return rpcNonceReq, nil
|
||||
|
||||
@@ -41,7 +41,7 @@ func (r *HandshakeResponse) Valid() error {
|
||||
// NewHandshakeResponse constructs new handshake response from the given
|
||||
// data.
|
||||
func NewHandshakeResponse(data []byte) (*HandshakeResponse, error) {
|
||||
if len(data) != 32 { // nolint: gomnd
|
||||
if len(data) != 32 { //nolint: gomnd
|
||||
return nil, fmt.Errorf("incorrect handshake response length %d", len(data))
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ func (r *NonceRequest) Bytes() []byte {
|
||||
|
||||
// NewNonceRequest builds new none request based on proxy secret.
|
||||
func NewNonceRequest(proxySecret []byte) (*NonceRequest, error) {
|
||||
nonce := make([]byte, 16) // nolint: gomnd
|
||||
keySelector := make([]byte, 4) // nolint: gomnd
|
||||
cryptoTS := make([]byte, 4) // nolint: gomnd
|
||||
nonce := make([]byte, 16) //nolint: gomnd
|
||||
keySelector := make([]byte, 4) //nolint: gomnd
|
||||
cryptoTS := make([]byte, 4) //nolint: gomnd
|
||||
|
||||
if _, err := rand.Read(nonce); err != nil {
|
||||
return nil, fmt.Errorf("cannot generate nonce: %w", err)
|
||||
@@ -39,7 +39,7 @@ func NewNonceRequest(proxySecret []byte) (*NonceRequest, error) {
|
||||
|
||||
copy(keySelector, proxySecret)
|
||||
// 256 ^ 4 - do not know how to name
|
||||
timestamp := time.Now().Truncate(time.Second).Unix() % 4294967296 // nolint: gomnd
|
||||
timestamp := time.Now().Truncate(time.Second).Unix() % 4294967296 //nolint: gomnd
|
||||
binary.LittleEndian.PutUint32(cryptoTS, uint32(timestamp))
|
||||
|
||||
return &NonceRequest{
|
||||
|
||||
@@ -44,7 +44,7 @@ func (r *NonceResponse) Valid(req *NonceRequest) error {
|
||||
|
||||
// NewNonceResponse build new nonce response based on the given data.
|
||||
func NewNonceResponse(data []byte) (*NonceResponse, error) {
|
||||
if len(data) != 32 { // nolint: gomnd
|
||||
if len(data) != 32 { //nolint: gomnd
|
||||
return nil, fmt.Errorf("unexpected message length %d", len(data))
|
||||
}
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ const (
|
||||
var ProxyRequestFlagsEncryptedPrefix [8]byte
|
||||
|
||||
func (r ProxyRequestFlags) Bytes() []byte {
|
||||
converted := make([]byte, 4) // nolint: gomnd
|
||||
converted := make([]byte, 4) //nolint: gomnd
|
||||
binary.LittleEndian.PutUint32(converted, uint32(r))
|
||||
|
||||
return converted
|
||||
}
|
||||
|
||||
func (r ProxyRequestFlags) String() string {
|
||||
flags := make([]string, 0, 7) // nolint: gomnd
|
||||
flags := make([]string, 0, 7) //nolint: gomnd
|
||||
|
||||
if r&ProxyRequestFlagsHasAdTag != 0 {
|
||||
flags = append(flags, "HAS_AD_TAG")
|
||||
|
||||
@@ -24,7 +24,7 @@ type ProxyResponse struct {
|
||||
func ParseProxyResponse(packet conntypes.Packet) (*ProxyResponse, error) {
|
||||
var response ProxyResponse
|
||||
|
||||
if len(packet) < 4 { // nolint: gomnd
|
||||
if len(packet) < 4 { //nolint: gomnd
|
||||
return nil, fmt.Errorf("incorrect packet length: %d", len(packet))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user