Ephemeral rendezvous client generates key using seckp256k1 curve
This commit is contained in:
parent
8aef7c4f15
commit
aab84e53dc
|
@ -767,7 +767,7 @@
|
|||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:b9b4aaa95bb880c345f400d7de8d5023731f71a9dfd4ff62ec77a74acfda529e"
|
||||
digest = "1:b88d64c27ed467659fa0ee1806bc790b88c37bcbff0b8fcd1b97d6a3ee7f9703"
|
||||
name = "github.com/status-im/rendezvous"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -775,7 +775,7 @@
|
|||
"server",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "7fe5bc0fd1c58bb7f7bec64656d8b821bec8338f"
|
||||
revision = "55370cdfd9f288059b03c04e23784bb8829a894c"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:572c783a763db6383aca3179976eb80e4c900f52eba56cba8bb2e3cea7ce720e"
|
||||
|
|
|
@ -21,7 +21,7 @@ func TestProxyToRendezvous(t *testing.T) {
|
|||
stop = make(chan struct{})
|
||||
wg sync.WaitGroup
|
||||
)
|
||||
client, err := rendezvous.NewTemporary()
|
||||
client, err := rendezvous.NewEphemeral()
|
||||
require.NoError(t, err)
|
||||
reg.Add(topic, id)
|
||||
wg.Add(1)
|
||||
|
|
|
@ -75,7 +75,7 @@ func (r *Rendezvous) Running() bool {
|
|||
func (r *Rendezvous) Start() error {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
client, err := rendezvous.NewTemporary()
|
||||
client, err := rendezvous.NewEphemeral()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -59,3 +59,18 @@ func TestRendezvousDiscovery(t *testing.T) {
|
|||
close(stop)
|
||||
close(period)
|
||||
}
|
||||
|
||||
func BenchmarkRendezvousStart(b *testing.B) {
|
||||
identity, err := crypto.GenerateKey()
|
||||
require.NoError(b, err)
|
||||
addr, err := ma.NewMultiaddr("/ip4/127.0.0.1/tcp/7777")
|
||||
require.NoError(b, err)
|
||||
node := discover.NewNode(discover.PubkeyID(&identity.PublicKey), net.IP{10, 10, 10, 10}, 10, 20)
|
||||
|
||||
b.ResetTimer()
|
||||
for n := 0; n < b.N; n++ {
|
||||
c, err := NewRendezvous([]ma.Multiaddr{addr}, identity, node)
|
||||
require.NoError(b, err)
|
||||
require.NoError(b, c.Start())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ import (
|
|||
|
||||
var logger = log.New("package", "rendezvous/client")
|
||||
|
||||
func NewTemporary() (c Client, err error) {
|
||||
priv, _, err := crypto.GenerateKeyPairWithReader(crypto.RSA, 2048, rand.Reader)
|
||||
func NewEphemeral() (c Client, err error) {
|
||||
priv, _, err := crypto.GenerateKeyPairWithReader(crypto.Secp256k1, 0, rand.Reader) // bits are ignored with edwards or secp251k1
|
||||
if err != nil {
|
||||
return Client{}, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue