mirror of
https://github.com/go-i2p/go-i2p.git
synced 2025-07-17 13:54:33 -04:00
gofumpt
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
// log "github.com/sirupsen/logrus"
|
// log "github.com/sirupsen/logrus"
|
||||||
|
@ -2,6 +2,7 @@ package data
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -91,13 +92,12 @@ func (str I2PString) Data() (data string, err error) {
|
|||||||
case ErrDataTooLong:
|
case ErrDataTooLong:
|
||||||
log.WithError(err).Warn("I2PString contains data beyond specified length")
|
log.WithError(err).Warn("I2PString contains data beyond specified length")
|
||||||
data = string(str[1:])
|
data = string(str[1:])
|
||||||
//data = string(str[1 : length+1]) // Should we recover and trim?
|
// data = string(str[1 : length+1]) // Should we recover and trim?
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
log.WithError(err).Error("Unknown error encountered in I2PString.Data()")
|
log.WithError(err).Error("Unknown error encountered in I2PString.Data()")
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if length == 0 {
|
if length == 0 {
|
||||||
log.Debug("I2PString is empty")
|
log.Debug("I2PString is empty")
|
||||||
|
@ -379,6 +379,7 @@ func KeyCertificateFromCertificate(certificate Certificate) (*KeyCertificate, er
|
|||||||
log.Debug("Successfully created keyCertificate from Certificate")
|
log.Debug("Successfully created keyCertificate from Certificate")
|
||||||
return k, nil
|
return k, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewKeyCertificateFromCertificate(cert Certificate) (*KeyCertificate, error) {
|
func NewKeyCertificateFromCertificate(cert Certificate) (*KeyCertificate, error) {
|
||||||
payload := cert.Data()
|
payload := cert.Data()
|
||||||
if len(payload) < 4 {
|
if len(payload) < 4 {
|
||||||
|
@ -418,6 +418,7 @@ func readCertificateFromEnd(data []byte) (cert Certificate, certStartIndex int,
|
|||||||
err = errors.New("could not find certificate in data")
|
err = errors.New("could not find certificate in data")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func constructPublicKey(data []byte, cryptoType uint16) (crypto.PublicKey, error) {
|
func constructPublicKey(data []byte, cryptoType uint16) (crypto.PublicKey, error) {
|
||||||
switch cryptoType {
|
switch cryptoType {
|
||||||
case CRYPTO_KEY_TYPE_ELGAMAL:
|
case CRYPTO_KEY_TYPE_ELGAMAL:
|
||||||
|
@ -3,12 +3,13 @@ package keys_and_cert
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/go-i2p/go-i2p/lib/common/certificate"
|
"github.com/go-i2p/go-i2p/lib/common/certificate"
|
||||||
"github.com/go-i2p/go-i2p/lib/common/data"
|
"github.com/go-i2p/go-i2p/lib/common/data"
|
||||||
"github.com/go-i2p/go-i2p/lib/common/key_certificate"
|
"github.com/go-i2p/go-i2p/lib/common/key_certificate"
|
||||||
"github.com/go-i2p/go-i2p/lib/crypto"
|
"github.com/go-i2p/go-i2p/lib/crypto"
|
||||||
"golang.org/x/crypto/openpgp/elgamal"
|
"golang.org/x/crypto/openpgp/elgamal"
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
@ -4,10 +4,11 @@ package lease
|
|||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
. "github.com/go-i2p/go-i2p/lib/common/data"
|
. "github.com/go-i2p/go-i2p/lib/common/data"
|
||||||
"github.com/go-i2p/go-i2p/lib/util/logger"
|
"github.com/go-i2p/go-i2p/lib/util/logger"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Sizes in bytes of various components of a Lease
|
// Sizes in bytes of various components of a Lease
|
||||||
|
@ -4,6 +4,7 @@ package lease_set
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-i2p/go-i2p/lib/common/signature"
|
"github.com/go-i2p/go-i2p/lib/common/signature"
|
||||||
|
|
||||||
"github.com/go-i2p/go-i2p/lib/util/logger"
|
"github.com/go-i2p/go-i2p/lib/util/logger"
|
||||||
|
@ -4,13 +4,14 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/go-i2p/go-i2p/lib/common/data"
|
"github.com/go-i2p/go-i2p/lib/common/data"
|
||||||
"github.com/go-i2p/go-i2p/lib/common/destination"
|
"github.com/go-i2p/go-i2p/lib/common/destination"
|
||||||
"github.com/go-i2p/go-i2p/lib/common/keys_and_cert"
|
"github.com/go-i2p/go-i2p/lib/common/keys_and_cert"
|
||||||
"github.com/go-i2p/go-i2p/lib/crypto"
|
"github.com/go-i2p/go-i2p/lib/crypto"
|
||||||
"golang.org/x/crypto/openpgp/elgamal"
|
"golang.org/x/crypto/openpgp/elgamal"
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-i2p/go-i2p/lib/common/certificate"
|
"github.com/go-i2p/go-i2p/lib/common/certificate"
|
||||||
"github.com/go-i2p/go-i2p/lib/common/lease"
|
"github.com/go-i2p/go-i2p/lib/common/lease"
|
||||||
|
@ -4,11 +4,12 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"github.com/go-i2p/go-i2p/lib/common/key_certificate"
|
|
||||||
"github.com/go-i2p/go-i2p/lib/common/keys_and_cert"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-i2p/go-i2p/lib/common/key_certificate"
|
||||||
|
"github.com/go-i2p/go-i2p/lib/common/keys_and_cert"
|
||||||
|
|
||||||
"github.com/go-i2p/go-i2p/lib/common/signature"
|
"github.com/go-i2p/go-i2p/lib/common/signature"
|
||||||
|
|
||||||
"github.com/go-i2p/go-i2p/lib/common/certificate"
|
"github.com/go-i2p/go-i2p/lib/common/certificate"
|
||||||
|
@ -4,6 +4,9 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/go-i2p/go-i2p/lib/common/certificate"
|
"github.com/go-i2p/go-i2p/lib/common/certificate"
|
||||||
"github.com/go-i2p/go-i2p/lib/common/data"
|
"github.com/go-i2p/go-i2p/lib/common/data"
|
||||||
"github.com/go-i2p/go-i2p/lib/common/key_certificate"
|
"github.com/go-i2p/go-i2p/lib/common/key_certificate"
|
||||||
@ -12,8 +15,6 @@ import (
|
|||||||
"github.com/go-i2p/go-i2p/lib/crypto"
|
"github.com/go-i2p/go-i2p/lib/crypto"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"golang.org/x/crypto/openpgp/elgamal"
|
"golang.org/x/crypto/openpgp/elgamal"
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-i2p/go-i2p/lib/common/router_address"
|
"github.com/go-i2p/go-i2p/lib/common/router_address"
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user