|
5 | 5 | # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). |
6 | 6 | # at your option. This file may not be copied, modified, or distributed except according to those terms. |
7 | 7 |
|
8 | | -{.push raises: [Defect].} |
| 8 | +{.push raises: [].} |
9 | 9 |
|
10 | 10 | import |
11 | 11 | std/hashes, |
|
28 | 28 | NodeId* = UInt256 |
29 | 29 |
|
30 | 30 | Address* = object |
31 | | - ip*: ValidIpAddress |
| 31 | + ip*: IpAddress |
32 | 32 | port*: Port |
33 | 33 |
|
34 | 34 | Stats* = object |
@@ -69,7 +69,7 @@ func newNode*( |
69 | 69 | id: ? pk.toNodeId(), |
70 | 70 | pubkey: pk, |
71 | 71 | record: record, |
72 | | - address: Address(ip: ValidIpAddress.init(ip), port: port).some) |
| 72 | + address: Address(ip: ip, port: port).some) |
73 | 73 |
|
74 | 74 | ok node |
75 | 75 |
|
@@ -103,7 +103,7 @@ func newNode*(r: SignedPeerRecord): Result[Node, cstring] = |
103 | 103 | record: r, |
104 | 104 | address: none(Address))) |
105 | 105 |
|
106 | | -proc update*(n: Node, pk: PrivateKey, ip: Option[ValidIpAddress], |
| 106 | +proc update*(n: Node, pk: PrivateKey, ip: Option[IpAddress], |
107 | 107 | tcpPort, udpPort: Option[Port] = none[Port]()): Result[void, cstring] = |
108 | 108 | ? n.record.update(pk, ip, tcpPort, udpPort) |
109 | 109 |
|
@@ -154,7 +154,7 @@ func shortLog*(id: NodeId): string = |
154 | 154 | result.add(sid[i]) |
155 | 155 | chronicles.formatIt(NodeId): shortLog(it) |
156 | 156 |
|
157 | | -func hash*(ip: ValidIpAddress): Hash = |
| 157 | +func hash*(ip: IpAddress): Hash = |
158 | 158 | case ip.family |
159 | 159 | of IpAddressFamily.IPv6: hash(ip.address_v6) |
160 | 160 | of IpAddressFamily.IPv4: hash(ip.address_v4) |
|
0 commit comments