mirror of
https://github.com/status-im/go-waku.git
synced 2025-01-13 15:24:46 +00:00
fix(rendezvous) - interop with nwaku
This commit is contained in:
parent
9207dbcb4a
commit
f18f219086
1
go.mod
1
go.mod
@ -60,6 +60,7 @@ require (
|
||||
github.com/quic-go/webtransport-go v0.5.2 // indirect
|
||||
github.com/rjeczalik/notify v0.9.3 // indirect
|
||||
github.com/status-im/status-go/extkeys v1.1.2 // indirect
|
||||
github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230601172541-0fad5ff68671 // indirect
|
||||
github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230331231302-258cacb91327 // indirect
|
||||
github.com/waku-org/go-zerokit-rln-arm v0.0.0-20230331223149-f90e66aebb0d // indirect
|
||||
github.com/waku-org/go-zerokit-rln-x86_64 v0.0.0-20230331181847-cba74520bae9 // indirect
|
||||
|
4
go.sum
4
go.sum
@ -1569,6 +1569,10 @@ github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1
|
||||
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
||||
github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98 h1:xwY0kW5XZFimdqfZb9cZwT1S3VJP9j3AE6bdNd9boXM=
|
||||
github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98/go.mod h1:eBHgM6T4EG0RZzxpxKy+rGz/6Dw2Nd8DWxS0lm9ESDw=
|
||||
github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230601155048-9806ad621c18 h1:BNd3c24LWmYyLFIFx5OpPMWPTGvkzkb6ITag1Ao/w4Q=
|
||||
github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230601155048-9806ad621c18/go.mod h1:/1YwD6sx3xsbrSkVa4++e8AUDcUjC035bgKwDsZo+0Q=
|
||||
github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230601172541-0fad5ff68671 h1:iOCDabjZ11Zk0ejdWBR54OEFA/rRZdQgIrX6Rv4U7AM=
|
||||
github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230601172541-0fad5ff68671/go.mod h1:/1YwD6sx3xsbrSkVa4++e8AUDcUjC035bgKwDsZo+0Q=
|
||||
github.com/waku-org/go-noise v0.0.4 h1:ZfQDcCw8pazm89EBl5SXY7GGAnzDQb9AHFXlw3Ktbvk=
|
||||
github.com/waku-org/go-noise v0.0.4/go.mod h1:+PWRfs2eSOVwKrPcQlfhwDngSh3faL/1QoxvoqggEKc=
|
||||
github.com/waku-org/go-zerokit-rln v0.1.12 h1:66+tU6sTlmUpuUlEv7kCFOGZ37MwZYFJBXHcm8QquwU=
|
||||
|
@ -6,6 +6,8 @@
|
||||
// 2_messages_index.up.sql (226B)
|
||||
// 3_rendezvous.down.sql (65B)
|
||||
// 3_rendezvous.up.sql (181B)
|
||||
// 4_signed_peer_record.down.sql (166B)
|
||||
// 4_signed_peer_record.up.sql (178B)
|
||||
// doc.go (74B)
|
||||
|
||||
package migrations
|
||||
@ -170,7 +172,7 @@ func _3_rendezvousDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "3_rendezvous.down.sql", size: 65, mode: os.FileMode(0664), modTime: time.Unix(1678306445, 0)}
|
||||
info := bindataFileInfo{name: "3_rendezvous.down.sql", size: 65, mode: os.FileMode(0664), modTime: time.Unix(1678392960, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1f, 0x4b, 0xc0, 0x7d, 0x4f, 0xac, 0xc4, 0x75, 0x59, 0xcc, 0xfc, 0x1a, 0x6c, 0x18, 0x81, 0x29, 0x24, 0x33, 0x3, 0x10, 0x39, 0xd0, 0x67, 0x28, 0xa0, 0xe0, 0xfd, 0x36, 0x91, 0x25, 0x37, 0x83}}
|
||||
return a, nil
|
||||
}
|
||||
@ -190,11 +192,51 @@ func _3_rendezvousUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "3_rendezvous.up.sql", size: 181, mode: os.FileMode(0664), modTime: time.Unix(1678306380, 0)}
|
||||
info := bindataFileInfo{name: "3_rendezvous.up.sql", size: 181, mode: os.FileMode(0664), modTime: time.Unix(1678392960, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5c, 0xb8, 0x4f, 0x88, 0xe9, 0xc6, 0xc, 0xbb, 0x2e, 0x56, 0xa2, 0xcd, 0x9, 0xfa, 0x33, 0x94, 0xd7, 0x73, 0xc1, 0xa, 0xc5, 0x69, 0xfb, 0x9f, 0x75, 0xdb, 0x75, 0x58, 0x20, 0x5e, 0xf, 0x14}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __4_signed_peer_recordDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xc9\xc1\x0a\x82\x40\x10\x06\xe0\xfb\x3e\xc5\x7f\x54\xf0\x18\x5d\x3c\x8d\x36\x94\x64\x25\xd3\x12\x78\x94\x1c\xc2\xcb\x2a\xb3\x1b\xf4\xf8\x81\xe1\xad\xeb\xf7\x1d\xe4\xd6\xc1\x53\xd5\x32\x4c\x5f\x53\x4c\x36\xa4\x69\x0e\xb1\x74\xae\x16\x26\xcf\xff\x12\x99\x03\x80\xe7\xfc\x0e\x49\x0d\x77\x96\x86\x5a\x74\xd2\x5c\x48\x7a\x9c\xb9\x2f\xd6\x5f\x54\x0d\x0f\x92\xfa\x44\x92\xed\x77\xf9\x4f\x43\xdc\xac\xc0\x0a\xfa\x59\x26\x53\x34\x57\xcf\x47\xde\x70\x18\x47\x8b\xa8\x7a\xcf\xe4\xf2\xf2\x1b\x00\x00\xff\xff\x2b\xea\xec\xa2\xa6\x00\x00\x00")
|
||||
|
||||
func _4_signed_peer_recordDownSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
__4_signed_peer_recordDownSql,
|
||||
"4_signed_peer_record.down.sql",
|
||||
)
|
||||
}
|
||||
|
||||
func _4_signed_peer_recordDownSql() (*asset, error) {
|
||||
bytes, err := _4_signed_peer_recordDownSqlBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.down.sql", size: 166, mode: os.FileMode(0664), modTime: time.Unix(1685640630, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9c, 0x4b, 0x6c, 0x4d, 0xe5, 0x90, 0x9e, 0xd5, 0xf9, 0x86, 0xe5, 0x23, 0xe2, 0xd, 0xbe, 0x3c, 0x28, 0x8f, 0x68, 0x8e, 0x8e, 0xe9, 0xc5, 0xf4, 0x60, 0x9b, 0xc7, 0x40, 0xca, 0x30, 0xb6, 0x9e}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __4_signed_peer_recordUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xc9\xb1\xaa\x83\x40\x10\x05\xd0\x7e\xbf\xe2\x96\x0a\x96\x8f\xd7\x58\x8d\x66\x48\x24\x26\x91\xc9\x12\xb0\x0c\x3a\xc8\x36\xab\xcc\x1a\xc8\xe7\x07\x0c\x76\x69\xcf\x39\xc8\xad\x83\xa7\xaa\x65\x98\x4e\x21\xad\xf6\x5c\xc3\x1c\x53\xe9\x5c\x2d\x4c\x9e\x7f\x25\x32\x07\x00\xc3\xfc\x8a\xab\x1a\xee\x2c\x0d\xb5\xe8\xa4\xb9\x90\xf4\x38\x73\x5f\x6c\xbf\xa8\x1a\x1e\x24\xf5\x89\x24\xfb\xff\xcb\xbf\x1a\xd3\x6e\x05\x36\xd0\xf7\x12\x4c\xd1\x5c\x3d\x1f\x79\xc7\x14\xa6\xa8\x63\xa7\x6a\xa2\xc3\x6c\x23\xaa\xde\x33\xb9\xbc\x74\x9f\x00\x00\x00\xff\xff\xa8\x37\x10\xd4\xb2\x00\x00\x00")
|
||||
|
||||
func _4_signed_peer_recordUpSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
__4_signed_peer_recordUpSql,
|
||||
"4_signed_peer_record.up.sql",
|
||||
)
|
||||
}
|
||||
|
||||
func _4_signed_peer_recordUpSql() (*asset, error) {
|
||||
bytes, err := _4_signed_peer_recordUpSqlBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.up.sql", size: 178, mode: os.FileMode(0664), modTime: time.Unix(1685640560, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb4, 0xa7, 0xfe, 0xfc, 0xdb, 0xd4, 0xad, 0x54, 0xb7, 0x67, 0xb, 0x97, 0x2a, 0xc5, 0x88, 0xc7, 0xe3, 0x49, 0x33, 0xa3, 0x13, 0x7e, 0xb4, 0x6a, 0x15, 0xf3, 0x6b, 0x7e, 0xc5, 0xb6, 0x38, 0x5f}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _docGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2c\xc9\xb1\x0d\xc4\x20\x0c\x05\xd0\x9e\x29\xfe\x02\xd8\xfd\x6d\xe3\x4b\xac\x2f\x44\x82\x09\x78\x7f\xa5\x49\xfd\xa6\x1d\xdd\xe8\xd8\xcf\x55\x8a\x2a\xe3\x47\x1f\xbe\x2c\x1d\x8c\xfa\x6f\xe3\xb4\x34\xd4\xd9\x89\xbb\x71\x59\xb6\x18\x1b\x35\x20\xa2\x9f\x0a\x03\xa2\xe5\x0d\x00\x00\xff\xff\x60\xcd\x06\xbe\x4a\x00\x00\x00")
|
||||
|
||||
func docGoBytes() ([]byte, error) {
|
||||
@ -318,6 +360,10 @@ var _bindata = map[string]func() (*asset, error){
|
||||
|
||||
"3_rendezvous.up.sql": _3_rendezvousUpSql,
|
||||
|
||||
"4_signed_peer_record.down.sql": _4_signed_peer_recordDownSql,
|
||||
|
||||
"4_signed_peer_record.up.sql": _4_signed_peer_recordUpSql,
|
||||
|
||||
"doc.go": docGo,
|
||||
}
|
||||
|
||||
@ -362,13 +408,15 @@ type bintree struct {
|
||||
}
|
||||
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"1_messages.down.sql": &bintree{_1_messagesDownSql, map[string]*bintree{}},
|
||||
"1_messages.up.sql": &bintree{_1_messagesUpSql, map[string]*bintree{}},
|
||||
"2_messages_index.down.sql": &bintree{_2_messages_indexDownSql, map[string]*bintree{}},
|
||||
"2_messages_index.up.sql": &bintree{_2_messages_indexUpSql, map[string]*bintree{}},
|
||||
"3_rendezvous.down.sql": &bintree{_3_rendezvousDownSql, map[string]*bintree{}},
|
||||
"3_rendezvous.up.sql": &bintree{_3_rendezvousUpSql, map[string]*bintree{}},
|
||||
"doc.go": &bintree{docGo, map[string]*bintree{}},
|
||||
"1_messages.down.sql": &bintree{_1_messagesDownSql, map[string]*bintree{}},
|
||||
"1_messages.up.sql": &bintree{_1_messagesUpSql, map[string]*bintree{}},
|
||||
"2_messages_index.down.sql": &bintree{_2_messages_indexDownSql, map[string]*bintree{}},
|
||||
"2_messages_index.up.sql": &bintree{_2_messages_indexUpSql, map[string]*bintree{}},
|
||||
"3_rendezvous.down.sql": &bintree{_3_rendezvousDownSql, map[string]*bintree{}},
|
||||
"3_rendezvous.up.sql": &bintree{_3_rendezvousUpSql, map[string]*bintree{}},
|
||||
"4_signed_peer_record.down.sql": &bintree{_4_signed_peer_recordDownSql, map[string]*bintree{}},
|
||||
"4_signed_peer_record.up.sql": &bintree{_4_signed_peer_recordUpSql, map[string]*bintree{}},
|
||||
"doc.go": &bintree{docGo, map[string]*bintree{}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory.
|
||||
|
@ -0,0 +1,9 @@
|
||||
DROP TABLE registrations;
|
||||
|
||||
CREATE TABLE registrations (
|
||||
counter SERIAL PRIMARY KEY,
|
||||
peer VARCHAR(64),
|
||||
ns VARCHAR,
|
||||
expire INTEGER,
|
||||
addrs BYTEA
|
||||
);
|
@ -0,0 +1,9 @@
|
||||
DROP TABLE registrations;
|
||||
|
||||
CREATE TABLE registrations (
|
||||
counter SERIAL PRIMARY KEY,
|
||||
peer VARCHAR(64),
|
||||
ns VARCHAR,
|
||||
expire INTEGER,
|
||||
signedPeerRecord BYTEA
|
||||
);
|
@ -6,6 +6,8 @@
|
||||
// 2_messages_index.up.sql (226B)
|
||||
// 3_rendezvous.down.sql (65B)
|
||||
// 3_rendezvous.up.sql (204B)
|
||||
// 4_signed_peer_record.down.sql (186B)
|
||||
// 4_signed_peer_record.up.sql (197B)
|
||||
// doc.go (74B)
|
||||
|
||||
package migrations
|
||||
@ -170,7 +172,7 @@ func _3_rendezvousDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "3_rendezvous.down.sql", size: 65, mode: os.FileMode(0664), modTime: time.Unix(1678305816, 0)}
|
||||
info := bindataFileInfo{name: "3_rendezvous.down.sql", size: 65, mode: os.FileMode(0664), modTime: time.Unix(1678392960, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1f, 0x4b, 0xc0, 0x7d, 0x4f, 0xac, 0xc4, 0x75, 0x59, 0xcc, 0xfc, 0x1a, 0x6c, 0x18, 0x81, 0x29, 0x24, 0x33, 0x3, 0x10, 0x39, 0xd0, 0x67, 0x28, 0xa0, 0xe0, 0xfd, 0x36, 0x91, 0x25, 0x37, 0x83}}
|
||||
return a, nil
|
||||
}
|
||||
@ -190,11 +192,51 @@ func _3_rendezvousUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "3_rendezvous.up.sql", size: 204, mode: os.FileMode(0664), modTime: time.Unix(1678306389, 0)}
|
||||
info := bindataFileInfo{name: "3_rendezvous.up.sql", size: 204, mode: os.FileMode(0664), modTime: time.Unix(1685637353, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb4, 0x9e, 0xd1, 0xde, 0xd4, 0xd3, 0x7, 0xc8, 0x7e, 0xa8, 0x54, 0xb5, 0xb3, 0xa1, 0x3c, 0x56, 0xd5, 0xcd, 0x61, 0xed, 0x9c, 0x82, 0x57, 0x24, 0x1f, 0x42, 0x98, 0xf4, 0x33, 0xa4, 0xc0, 0x16}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __4_signed_peer_recordDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xcc\xb1\xaa\x83\x40\x10\x85\xe1\x7e\x9f\xe2\x94\x0a\x96\x97\xdb\x58\x8d\x66\x48\x96\xc4\x55\x86\x4d\xc0\x52\xe2\x10\x6c\x54\x46\x03\x79\xfc\x80\x89\x5d\xda\xef\xfc\x9c\x83\xd4\x0d\x22\x15\x17\x86\xe9\x63\x58\x56\xeb\xd6\x61\x1a\x97\xdc\xb9\x52\x98\x22\xff\x1a\x91\x38\x00\xb8\x4f\xcf\x71\x55\x83\x0f\x91\x8f\x2c\x68\xc4\x57\x24\x2d\xce\xdc\x82\xae\xb1\xf6\xa1\x14\xae\x38\xc4\x6c\xcb\x67\x55\xc3\x8d\xa4\x3c\x91\x24\xff\x7f\xe9\x47\xc7\x65\xb7\x0c\x1b\xe8\x6b\x1e\x4c\xf7\xd3\x2f\x76\x7d\x6f\x5b\x58\xf8\x40\xd2\xba\x34\x77\xef\x00\x00\x00\xff\xff\x25\xbc\x5b\xc0\xba\x00\x00\x00")
|
||||
|
||||
func _4_signed_peer_recordDownSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
__4_signed_peer_recordDownSql,
|
||||
"4_signed_peer_record.down.sql",
|
||||
)
|
||||
}
|
||||
|
||||
func _4_signed_peer_recordDownSql() (*asset, error) {
|
||||
bytes, err := _4_signed_peer_recordDownSqlBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.down.sql", size: 186, mode: os.FileMode(0664), modTime: time.Unix(1685637492, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3c, 0x8b, 0xe8, 0x6a, 0xb6, 0x92, 0xff, 0x78, 0x83, 0xdb, 0x5d, 0x67, 0x93, 0x4b, 0xe3, 0xb3, 0x16, 0x9e, 0x22, 0x9e, 0xd4, 0xcb, 0xcc, 0x10, 0xf2, 0xa9, 0xa, 0x3c, 0xef, 0x80, 0xe0, 0x13}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __4_signed_peer_recordUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xcc\x3d\xcb\x83\x30\x10\x07\xf0\x3d\x9f\xe2\x46\x05\xc7\x87\x67\x71\x3a\xed\xd1\x86\xd6\x28\x47\x5a\x70\x2c\x7a\x48\x96\x28\x17\x0b\xfd\xf8\xa5\xb6\x6e\x5d\x7f\xff\x97\x03\xb7\x1d\x78\xac\x2e\x04\x2a\x53\x48\xab\xde\xd7\x30\xc7\x54\x1a\x53\x33\xa1\xa7\x5f\x21\x64\x06\x00\x60\x98\x1f\x71\x15\x05\xeb\x3c\x1d\x89\xa1\x63\xdb\x20\xf7\x70\xa6\x1e\xf0\xea\x5b\xeb\x6a\xa6\x86\x9c\x2f\xb6\xfa\x22\xa2\x70\x43\xae\x4f\xc8\xd9\xff\x5f\xfe\xd1\x98\x76\x2b\x60\x03\x79\x2e\x41\x65\x3f\xfd\x62\x0a\x53\x94\xb1\x13\x51\x96\x61\xd6\xf1\xbd\xa9\xac\x43\xee\x4d\x5e\x9a\x57\x00\x00\x00\xff\xff\x1a\xe7\xdf\x9f\xc5\x00\x00\x00")
|
||||
|
||||
func _4_signed_peer_recordUpSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
__4_signed_peer_recordUpSql,
|
||||
"4_signed_peer_record.up.sql",
|
||||
)
|
||||
}
|
||||
|
||||
func _4_signed_peer_recordUpSql() (*asset, error) {
|
||||
bytes, err := _4_signed_peer_recordUpSqlBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.up.sql", size: 197, mode: os.FileMode(0664), modTime: time.Unix(1685637465, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xed, 0xf9, 0xc2, 0x12, 0xe0, 0xbd, 0x3d, 0xc9, 0x37, 0xb9, 0xfe, 0xa0, 0xda, 0x92, 0x99, 0xa8, 0x3a, 0x46, 0x7a, 0x3a, 0x26, 0xc, 0x63, 0x1c, 0x9a, 0x87, 0xce, 0x26, 0x7c, 0x9e, 0x87, 0x28}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _docGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2c\xc9\xb1\x0d\xc4\x20\x0c\x05\xd0\x9e\x29\xfe\x02\xd8\xfd\x6d\xe3\x4b\xac\x2f\x44\x82\x09\x78\x7f\xa5\x49\xfd\xa6\x1d\xdd\xe8\xd8\xcf\x55\x8a\x2a\xe3\x47\x1f\xbe\x2c\x1d\x8c\xfa\x6f\xe3\xb4\x34\xd4\xd9\x89\xbb\x71\x59\xb6\x18\x1b\x35\x20\xa2\x9f\x0a\x03\xa2\xe5\x0d\x00\x00\xff\xff\x60\xcd\x06\xbe\x4a\x00\x00\x00")
|
||||
|
||||
func docGoBytes() ([]byte, error) {
|
||||
@ -318,6 +360,10 @@ var _bindata = map[string]func() (*asset, error){
|
||||
|
||||
"3_rendezvous.up.sql": _3_rendezvousUpSql,
|
||||
|
||||
"4_signed_peer_record.down.sql": _4_signed_peer_recordDownSql,
|
||||
|
||||
"4_signed_peer_record.up.sql": _4_signed_peer_recordUpSql,
|
||||
|
||||
"doc.go": docGo,
|
||||
}
|
||||
|
||||
@ -362,13 +408,15 @@ type bintree struct {
|
||||
}
|
||||
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"1_messages.down.sql": &bintree{_1_messagesDownSql, map[string]*bintree{}},
|
||||
"1_messages.up.sql": &bintree{_1_messagesUpSql, map[string]*bintree{}},
|
||||
"2_messages_index.down.sql": &bintree{_2_messages_indexDownSql, map[string]*bintree{}},
|
||||
"2_messages_index.up.sql": &bintree{_2_messages_indexUpSql, map[string]*bintree{}},
|
||||
"3_rendezvous.down.sql": &bintree{_3_rendezvousDownSql, map[string]*bintree{}},
|
||||
"3_rendezvous.up.sql": &bintree{_3_rendezvousUpSql, map[string]*bintree{}},
|
||||
"doc.go": &bintree{docGo, map[string]*bintree{}},
|
||||
"1_messages.down.sql": &bintree{_1_messagesDownSql, map[string]*bintree{}},
|
||||
"1_messages.up.sql": &bintree{_1_messagesUpSql, map[string]*bintree{}},
|
||||
"2_messages_index.down.sql": &bintree{_2_messages_indexDownSql, map[string]*bintree{}},
|
||||
"2_messages_index.up.sql": &bintree{_2_messages_indexUpSql, map[string]*bintree{}},
|
||||
"3_rendezvous.down.sql": &bintree{_3_rendezvousDownSql, map[string]*bintree{}},
|
||||
"3_rendezvous.up.sql": &bintree{_3_rendezvousUpSql, map[string]*bintree{}},
|
||||
"4_signed_peer_record.down.sql": &bintree{_4_signed_peer_recordDownSql, map[string]*bintree{}},
|
||||
"4_signed_peer_record.up.sql": &bintree{_4_signed_peer_recordUpSql, map[string]*bintree{}},
|
||||
"doc.go": &bintree{docGo, map[string]*bintree{}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory.
|
||||
|
@ -0,0 +1,9 @@
|
||||
DROP TABLE registrations;
|
||||
|
||||
CREATE TABLE registrations (
|
||||
counter INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
peer VARCHAR(64),
|
||||
ns VARCHAR,
|
||||
expire INTEGER,
|
||||
addrs VARBINARY
|
||||
);
|
@ -0,0 +1,9 @@
|
||||
DROP TABLE registrations;
|
||||
|
||||
CREATE TABLE registrations (
|
||||
counter INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
peer VARCHAR(64),
|
||||
ns VARCHAR,
|
||||
expire INTEGER,
|
||||
signedPeerRecord VARBINARY
|
||||
);
|
@ -11,8 +11,8 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
dbi "github.com/berty/go-libp2p-rendezvous/db"
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
dbi "github.com/waku-org/go-libp2p-rendezvous/db"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@ -164,9 +164,8 @@ func (db *DB) prepareStmts() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (db *DB) Register(p peer.ID, ns string, addrs [][]byte, ttl int) (uint64, error) {
|
||||
func (db *DB) Register(p peer.ID, ns string, signedPeerRecord []byte, ttl int) (uint64, error) {
|
||||
pid := p.Pretty()
|
||||
maddrs := packAddrs(addrs)
|
||||
expire := time.Now().Unix() + int64(ttl)
|
||||
|
||||
tx, err := db.db.Begin()
|
||||
@ -184,7 +183,7 @@ func (db *DB) Register(p peer.ID, ns string, addrs [][]byte, ttl int) (uint64, e
|
||||
return 0, err
|
||||
}
|
||||
|
||||
_, err = insertNew.Exec(pid, ns, expire, maddrs)
|
||||
_, err = insertNew.Exec(pid, ns, expire, signedPeerRecord)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return 0, err
|
||||
@ -268,16 +267,15 @@ func (db *DB) Discover(ns string, cookie []byte, limit int) ([]dbi.RegistrationR
|
||||
regs := make([]dbi.RegistrationRecord, 0, limit)
|
||||
for rows.Next() {
|
||||
var (
|
||||
reg dbi.RegistrationRecord
|
||||
rid string
|
||||
rns string
|
||||
expire int64
|
||||
raddrs []byte
|
||||
addrs [][]byte
|
||||
p peer.ID
|
||||
reg dbi.RegistrationRecord
|
||||
rid string
|
||||
rns string
|
||||
expire int64
|
||||
signedPeerRecord []byte
|
||||
p peer.ID
|
||||
)
|
||||
|
||||
err = rows.Scan(&counter, &rid, &rns, &expire, &raddrs)
|
||||
err = rows.Scan(&counter, &rid, &rns, &expire, &signedPeerRecord)
|
||||
if err != nil {
|
||||
db.logger.Error("row scan error", zap.Error(err))
|
||||
return nil, nil, err
|
||||
@ -289,14 +287,8 @@ func (db *DB) Discover(ns string, cookie []byte, limit int) ([]dbi.RegistrationR
|
||||
continue
|
||||
}
|
||||
|
||||
addrs, err := unpackAddrs(raddrs)
|
||||
if err != nil {
|
||||
db.logger.Error("error unpacking address", zap.Error(err))
|
||||
continue
|
||||
}
|
||||
|
||||
reg.Id = p
|
||||
reg.Addrs = addrs
|
||||
reg.SignedPeerRecord = signedPeerRecord
|
||||
reg.Ttl = int(expire - now)
|
||||
|
||||
if ns == "" {
|
||||
@ -342,47 +334,6 @@ func (db *DB) cleanupExpired() {
|
||||
}
|
||||
}
|
||||
|
||||
func packAddrs(addrs [][]byte) []byte {
|
||||
packlen := 0
|
||||
for _, addr := range addrs {
|
||||
packlen = packlen + 2 + len(addr)
|
||||
}
|
||||
|
||||
packed := make([]byte, packlen)
|
||||
buf := packed
|
||||
for _, addr := range addrs {
|
||||
binary.BigEndian.PutUint16(buf, uint16(len(addr)))
|
||||
buf = buf[2:]
|
||||
copy(buf, addr)
|
||||
buf = buf[len(addr):]
|
||||
}
|
||||
|
||||
return packed
|
||||
}
|
||||
|
||||
func unpackAddrs(packed []byte) ([][]byte, error) {
|
||||
var addrs [][]byte
|
||||
|
||||
buf := packed
|
||||
for len(buf) > 1 {
|
||||
l := binary.BigEndian.Uint16(buf)
|
||||
buf = buf[2:]
|
||||
if len(buf) < int(l) {
|
||||
return nil, fmt.Errorf("bad packed address: not enough bytes %v %v", packed, buf)
|
||||
}
|
||||
addr := make([]byte, l)
|
||||
copy(addr, buf[:l])
|
||||
buf = buf[l:]
|
||||
addrs = append(addrs, addr)
|
||||
}
|
||||
|
||||
if len(buf) > 0 {
|
||||
return nil, fmt.Errorf("bad packed address: unprocessed bytes: %v %v", packed, buf)
|
||||
}
|
||||
|
||||
return addrs, nil
|
||||
}
|
||||
|
||||
// cookie: counter:SHA256(nonce + ns + counter)
|
||||
func packCookie(counter int64, ns string, nonce []byte) []byte {
|
||||
cbits := make([]byte, 8)
|
||||
|
@ -7,9 +7,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
rvs "github.com/berty/go-libp2p-rendezvous"
|
||||
"github.com/libp2p/go-libp2p/core/host"
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
rvs "github.com/waku-org/go-libp2p-rendezvous"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
@ -116,6 +116,8 @@ func (r *Rendezvous) discover(ctx context.Context) {
|
||||
if err != nil {
|
||||
r.log.Error("could not discover new peers", zap.Error(err))
|
||||
cookie = nil
|
||||
// TODO: add backoff strategy
|
||||
// continue
|
||||
}
|
||||
|
||||
if len(addrInfo) != 0 {
|
||||
@ -133,7 +135,7 @@ func (r *Rendezvous) discover(ctx context.Context) {
|
||||
} else {
|
||||
// TODO: change log level to DEBUG in go-libp2p-rendezvous@v0.4.1/svc.go:234 discover query
|
||||
// TODO: improve this by adding an exponential backoff?
|
||||
time.Sleep(2 * time.Second)
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user