mirror of
https://github.com/go-i2p/go-i2p.git
synced 2025-07-04 13:32:52 -04:00
format with go fmt
This commit is contained in:
@ -10,7 +10,6 @@ import (
|
||||
// i2p base32 encoding
|
||||
var I2PEncoding *b32.Encoding = b32.NewEncoding("abcdefghijklmnopqrstuvwxyz234567")
|
||||
|
||||
|
||||
// wrapper arround encoding for encoding to string
|
||||
func EncodeToString(data []byte) (str string) {
|
||||
str = I2PEncoding.EncodeToString(data)
|
||||
|
@ -1,5 +1,4 @@
|
||||
package common
|
||||
|
||||
|
||||
// the sha256 of some datastructure
|
||||
type IdentHash [32]byte
|
||||
|
@ -1,6 +1,5 @@
|
||||
package config
|
||||
|
||||
|
||||
type BootstrapConfig struct {
|
||||
LowPeerThreshold int
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package crypto
|
||||
|
||||
import (
|
||||
"crypto/dsa"
|
||||
"crypto/sha1"
|
||||
"crypto/rand"
|
||||
"crypto/sha1"
|
||||
"io"
|
||||
"math/big"
|
||||
)
|
||||
@ -22,7 +22,7 @@ var dsap = new(big.Int).SetBytes([]byte{
|
||||
var dsaq = new(big.Int).SetBytes([]byte{
|
||||
0xa5, 0xdf, 0xc2, 0x8f, 0xef, 0x4c, 0xa1, 0xe2, 0x86, 0x74, 0x4c, 0xd8, 0xee, 0xd9, 0xd2, 0x9d,
|
||||
0x68, 0x40, 0x46, 0xb7,
|
||||
});
|
||||
})
|
||||
|
||||
var dsag = new(big.Int).SetBytes([]byte{
|
||||
0x0c, 0x1f, 0x4d, 0x27, 0xd4, 0x00, 0x93, 0xb4, 0x29, 0xe9, 0x62, 0xd7, 0x22, 0x38, 0x24, 0xe0,
|
||||
@ -33,7 +33,7 @@ var dsag = new(big.Int).SetBytes([]byte{
|
||||
0x6b, 0xd5, 0x40, 0x9c, 0xd2, 0xf4, 0x50, 0x82, 0x11, 0x42, 0xa5, 0xe6, 0xf8, 0xeb, 0x1c, 0x3a,
|
||||
0xb5, 0xd0, 0x48, 0x4b, 0x81, 0x29, 0xfc, 0xf1, 0x7b, 0xce, 0x4f, 0x7f, 0x33, 0x32, 0x1c, 0x3c,
|
||||
0xb3, 0xdb, 0xb1, 0x4a, 0x90, 0x5e, 0x7b, 0x2b, 0x3e, 0x93, 0xbe, 0x47, 0x08, 0xcb, 0xcc, 0x82,
|
||||
});
|
||||
})
|
||||
|
||||
var param = dsa.Parameters{
|
||||
P: dsap,
|
||||
@ -72,7 +72,6 @@ func createDSAPrivkey(X *big.Int) *dsa.PrivateKey {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
type DSAVerifier struct {
|
||||
k *dsa.PublicKey
|
||||
}
|
||||
@ -111,7 +110,6 @@ func (v *DSAVerifier) VerifyHash(h, sig []byte) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
func (k DSAPublicKey) Len() int {
|
||||
return len(k)
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
func TestDSA(t *testing.T) {
|
||||
rng := rand.Reader
|
||||
kp := new(dsa.PrivateKey)
|
||||
|
@ -1,5 +1,4 @@
|
||||
package crypto
|
||||
|
||||
|
||||
type Ed25519PublicKey [32]byte
|
||||
type Ed25519PrivateKey [32]byte
|
||||
|
@ -97,7 +97,6 @@ func elgamalDecrypt(priv *elgamal.PrivateKey, data []byte, zeroPadding bool) (de
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
type ElgamalEncryption struct {
|
||||
p, a, b1 *big.Int
|
||||
}
|
||||
@ -184,7 +183,6 @@ func createElgamalEncryption(pub *elgamal.PublicKey, rand io.Reader) (enc *Elgam
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
type ElgPublicKey [256]byte
|
||||
type ElgPrivateKey [256]byte
|
||||
|
||||
@ -198,7 +196,6 @@ func (elg ElgPublicKey) NewEncrypter() (enc Encrypter, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
func (elg ElgPrivateKey) Len() int {
|
||||
return len(elg)
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
func TestElg(t *testing.T) {
|
||||
k := new(elgamal.PrivateKey)
|
||||
err := ElgamalGenerate(k, rand.Reader)
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
// XXX: IMPLEMENT THIS
|
||||
func Test_I2PHMAC(t *testing.T) {
|
||||
data := make([]byte, 64)
|
||||
|
@ -1,6 +1,5 @@
|
||||
package crypto
|
||||
|
||||
|
||||
type RSA2048PublicKey [256]byte
|
||||
type RSA2048PrivateKey [512]byte
|
||||
|
||||
@ -9,4 +8,3 @@ type RSA3072PrivateKey [786]byte
|
||||
|
||||
type RSA4096PublicKey [512]byte
|
||||
type RSA4096PrivateKey [1024]byte
|
||||
|
||||
|
@ -26,7 +26,6 @@ type SigningPublicKey interface {
|
||||
Len() int
|
||||
}
|
||||
|
||||
|
||||
// type for signing data
|
||||
type Signer interface {
|
||||
// sign data with our private key by calling SignHash after hashing the data we are given
|
||||
@ -38,7 +37,6 @@ type Signer interface {
|
||||
SignHash(h []byte) (sig []byte, err error)
|
||||
}
|
||||
|
||||
|
||||
// key for signing data
|
||||
type SigningPrivateKey interface {
|
||||
// create a new signer to sign data
|
||||
|
@ -1,4 +1,5 @@
|
||||
package crypto
|
||||
|
||||
import (
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
@ -8,6 +9,7 @@ type TunnelData [1024]byte
|
||||
|
||||
// A symetric key for encrypting tunnel messages
|
||||
type TunnelKey [32]byte
|
||||
|
||||
// The initialization vector for a tunnel message
|
||||
type TunnelIV []byte
|
||||
|
||||
|
@ -1,2 +1 @@
|
||||
package stdi2p
|
||||
|
||||
|
@ -7,7 +7,6 @@ type Reseed interface {
|
||||
Reseed(chnl chan *Entry) error
|
||||
}
|
||||
|
||||
|
||||
func GetRandomReseed() Reseed {
|
||||
// TODO: hardcoded value
|
||||
return HTTPSReseed("https://i2p.rocks:445/")
|
||||
|
@ -1,8 +1,8 @@
|
||||
package netdb
|
||||
|
||||
import (
|
||||
log "github.com/golang/glog"
|
||||
"github.com/bounce-chat/go-i2p/lib/common"
|
||||
log "github.com/golang/glog"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
@ -10,7 +10,6 @@ import (
|
||||
// standard network database implementation
|
||||
type StdNetDB string
|
||||
|
||||
|
||||
// get netdb path
|
||||
func (db StdNetDB) Path() string {
|
||||
return string(db)
|
||||
@ -43,7 +42,6 @@ func (db StdNetDB) SaveEntry(e *Entry) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// reseed if we have less than minRouters known routers
|
||||
// returns error if reseed failed
|
||||
func (db StdNetDB) Reseed(minRouters int) (err error) {
|
||||
|
@ -11,7 +11,6 @@ type Router struct {
|
||||
ndb netdb.StdNetDB
|
||||
}
|
||||
|
||||
|
||||
func CreateRouter() (r *Router, err error) {
|
||||
cfg := config.Router
|
||||
r = &Router{
|
||||
|
@ -4,4 +4,3 @@ i2p ssu transport implementation
|
||||
|
||||
*/
|
||||
package ssu
|
||||
|
||||
|
@ -1,3 +1 @@
|
||||
package ssu
|
||||
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package stdi2p
|
||||
|
||||
|
||||
// Router Identity
|
||||
type RouterIdentity struct {
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
package stdi2p
|
||||
|
||||
|
||||
type RouterInfo struct {
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package stdi2p
|
||||
|
||||
|
||||
// i2p date time stamp
|
||||
type Date [8]byte
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package stdi2p
|
||||
|
||||
|
||||
// an su3 archive
|
||||
type SU3 struct {
|
||||
|
||||
}
|
||||
|
@ -15,12 +15,10 @@ type DelayFactor byte
|
||||
|
||||
type DeliveryInstructions []byte
|
||||
|
||||
|
||||
func (di DeliveryInstructions) DeliveryType() byte {
|
||||
return (di[0] & 0x30) >> 4
|
||||
}
|
||||
|
||||
|
||||
func (di DeliveryInstructions) IsFragmented() bool {
|
||||
return (di[0] & 0x08) == 0x08
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package tunnel
|
||||
|
||||
import (
|
||||
"github.com/bounce-chat/go-i2p/lib/crypto"
|
||||
"encoding/binary"
|
||||
"github.com/bounce-chat/go-i2p/lib/crypto"
|
||||
)
|
||||
|
||||
type TunnelID uint32
|
||||
|
@ -7,4 +7,3 @@ import (
|
||||
type Participant struct {
|
||||
decryption *crypto.Tunnel
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user