common: remove websocket type from wireaddr.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-05-30 13:58:18 +09:30
parent e66cf46a71
commit 3f35d48fe4
15 changed files with 10 additions and 67 deletions

View file

@ -103,7 +103,6 @@ message GetinfoAddress {
IPV6 = 2;
TORV2 = 3;
TORV3 = 4;
WEBSOCKET = 5;
}
GetinfoAddressType item_type = 1;
uint32 port = 2;
@ -829,7 +828,6 @@ message ListnodesNodesAddresses {
IPV6 = 2;
TORV2 = 3;
TORV3 = 4;
WEBSOCKET = 5;
}
ListnodesNodesAddressesType item_type = 1;
uint32 port = 2;

10
cln-rpc/src/model.rs generated
View file

@ -1433,7 +1433,7 @@ pub mod responses {
pub invoice: String,
}
/// Type of connection
/// Type of connection (until 23.08, `websocket` was also allowed)
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
pub enum GetinfoAddressType {
#[serde(rename = "dns")]
@ -1446,8 +1446,6 @@ pub mod responses {
TORV2,
#[serde(rename = "torv3")]
TORV3,
#[serde(rename = "websocket")]
WEBSOCKET,
}
impl TryFrom<i32> for GetinfoAddressType {
@ -1459,7 +1457,6 @@ pub mod responses {
2 => Ok(GetinfoAddressType::IPV6),
3 => Ok(GetinfoAddressType::TORV2),
4 => Ok(GetinfoAddressType::TORV3),
5 => Ok(GetinfoAddressType::WEBSOCKET),
o => Err(anyhow::anyhow!("Unknown variant {} for enum GetinfoAddressType", o)),
}
}
@ -2733,7 +2730,7 @@ pub mod responses {
}
}
/// Type of connection
/// Type of connection (until 23.08, `websocket` was also allowed)
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
pub enum ListnodesNodesAddressesType {
#[serde(rename = "dns")]
@ -2746,8 +2743,6 @@ pub mod responses {
TORV2,
#[serde(rename = "torv3")]
TORV3,
#[serde(rename = "websocket")]
WEBSOCKET,
}
impl TryFrom<i32> for ListnodesNodesAddressesType {
@ -2759,7 +2754,6 @@ pub mod responses {
2 => Ok(ListnodesNodesAddressesType::IPV6),
3 => Ok(ListnodesNodesAddressesType::TORV2),
4 => Ok(ListnodesNodesAddressesType::TORV3),
5 => Ok(ListnodesNodesAddressesType::WEBSOCKET),
o => Err(anyhow::anyhow!("Unknown variant {} for enum ListnodesNodesAddressesType", o)),
}
}

View file

@ -521,9 +521,6 @@ void json_add_address(struct json_stream *response, const char *fieldname,
json_add_string(response, "type", "dns");
json_add_string(response, "address", fmt_wireaddr_without_port(tmpctx, addr));
json_add_num(response, "port", addr->port);
} else if (addr->type == ADDR_TYPE_WEBSOCKET) {
json_add_string(response, "type", "websocket");
json_add_num(response, "port", addr->port);
}
json_object_end(response);
}

View file

@ -50,9 +50,6 @@ bool fromwire_wireaddr(const u8 **cursor, size_t *max, struct wireaddr *addr)
memset(&addr->addr, 0, sizeof(addr->addr));
addr->addr[addr->addrlen] = 0;
break;
case ADDR_TYPE_WEBSOCKET:
addr->addrlen = 0;
break;
default:
return false;
}
@ -178,14 +175,6 @@ void wireaddr_from_ipv6(struct wireaddr *addr,
memcpy(&addr->addr, ip6, addr->addrlen);
}
void wireaddr_from_websocket(struct wireaddr *addr, const u16 port)
{
addr->type = ADDR_TYPE_WEBSOCKET;
addr->addrlen = 0;
addr->port = port;
memset(addr->addr, 0, sizeof(addr->addr));
}
bool wireaddr_to_ipv4(const struct wireaddr *addr, struct sockaddr_in *s4)
{
if (addr->type != ADDR_TYPE_IPV4)
@ -210,14 +199,6 @@ bool wireaddr_to_ipv6(const struct wireaddr *addr, struct sockaddr_in6 *s6)
return true;
}
bool wireaddr_to_websocket(const struct wireaddr *addr, u16 *port)
{
if (addr->type != ADDR_TYPE_WEBSOCKET)
return false;
*port = addr->port;
return true;
}
bool wireaddr_is_wildcard(const struct wireaddr *addr)
{
switch (addr->type) {
@ -227,7 +208,6 @@ bool wireaddr_is_wildcard(const struct wireaddr *addr)
case ADDR_TYPE_TOR_V2_REMOVED:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_DNS:
case ADDR_TYPE_WEBSOCKET:
return false;
}
abort();
@ -277,8 +257,6 @@ char *fmt_wireaddr_without_port(const tal_t * ctx, const struct wireaddr *a)
b32_encode(tmpctx, a->addr, a->addrlen));
case ADDR_TYPE_DNS:
return tal_fmt(ctx, "%s", a->addr);
case ADDR_TYPE_WEBSOCKET:
return tal_strdup(ctx, "websocket");
}
hex = tal_hexstr(ctx, a->addr, a->addrlen);
@ -804,7 +782,6 @@ struct addrinfo *wireaddr_to_addrinfo(const tal_t *ctx,
case ADDR_TYPE_TOR_V2_REMOVED:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_DNS:
case ADDR_TYPE_WEBSOCKET:
break;
}
abort();
@ -860,7 +837,6 @@ bool all_tor_addresses(const struct wireaddr_internal *wireaddr)
return false;
case ADDR_TYPE_TOR_V2_REMOVED:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_WEBSOCKET:
continue;
}
}

View file

@ -30,10 +30,6 @@ struct sockaddr_un;
* * `5`: DNS hostname; data = `[byte:len][len*byte:hostname][u16:port]` (length up to 258)
*/
/* BOLT-websockets #7:
* * `6`: WebSocket port; data = `[2:port]` (length 2)
*/
#define TOR_V2_ADDRLEN 10
#define TOR_V3_ADDRLEN 35
#define DNS_ADDRLEN 255
@ -47,7 +43,6 @@ enum wire_addr_type {
ADDR_TYPE_TOR_V2_REMOVED = 3,
ADDR_TYPE_TOR_V3 = 4,
ADDR_TYPE_DNS = 5,
ADDR_TYPE_WEBSOCKET = 6
};
struct wireaddr {
@ -113,10 +108,8 @@ void wireaddr_from_ipv4(struct wireaddr *addr,
void wireaddr_from_ipv6(struct wireaddr *addr,
const struct in6_addr *ip6,
const u16 port);
void wireaddr_from_websocket(struct wireaddr *addr, const u16 port);
bool wireaddr_to_ipv4(const struct wireaddr *addr, struct sockaddr_in *s4);
bool wireaddr_to_ipv6(const struct wireaddr *addr, struct sockaddr_in6 *s6);
bool wireaddr_to_websocket(const struct wireaddr *addr, u16 *port);
bool wireaddr_is_wildcard(const struct wireaddr *addr);

View file

@ -884,9 +884,6 @@ static void try_connect_one_addr(struct connecting *connect)
}
freeaddrinfo(ais);
goto next;
case ADDR_TYPE_WEBSOCKET:
af = -1;
break;
}
}
@ -1064,7 +1061,6 @@ static struct listen_fd *handle_wireaddr_listen(const tal_t *ctx,
return make_listen_fd(ctx, wi, AF_INET6, &addr6, sizeof(addr6),
listen_mayfail, is_websocket, errstr);
/* Handle specially by callers. */
case ADDR_TYPE_WEBSOCKET:
case ADDR_TYPE_TOR_V2_REMOVED:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_DNS:
@ -1683,7 +1679,6 @@ static void add_gossip_addrs(struct wireaddr_internal **addrs,
break;
/* We can't use these to connect to! */
case ADDR_TYPE_TOR_V2_REMOVED:
case ADDR_TYPE_WEBSOCKET:
break;
}
/* Other results returned are possible, but we don't understand

View file

@ -259,7 +259,6 @@ bool guess_address(struct wireaddr *addr)
case ADDR_TYPE_TOR_V2_REMOVED:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_DNS:
case ADDR_TYPE_WEBSOCKET:
status_broken("Cannot guess address type %u", addr->type);
break;
}

View file

@ -118,7 +118,6 @@ static struct io_plan *peer_init_received(struct io_conn *conn,
case ADDR_TYPE_TOR_V2_REMOVED:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_DNS:
case ADDR_TYPE_WEBSOCKET:
remote_addr = tal_free(remote_addr);
break;
}
@ -249,7 +248,6 @@ struct io_plan *peer_exchange_initmsg(struct io_conn *conn,
case ADDR_TYPE_TOR_V2_REMOVED:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_DNS:
case ADDR_TYPE_WEBSOCKET:
break;
}
}

View file

@ -347,9 +347,6 @@ int main(int argc, char *argv[])
case ADDR_TYPE_TOR_V3:
opt_usage_exit_fail("Don't support proxy use");
break;
case ADDR_TYPE_WEBSOCKET:
opt_usage_exit_fail("Don't support websockets");
break;
case ADDR_TYPE_DNS:
opt_usage_exit_fail("Don't support DNS");
break;

View file

@ -41,7 +41,7 @@ On success, an object is returned, containing:
- **network** (string): represents the type of network on the node are working (e.g: `bitcoin`, `testnet`, or `regtest`)
- **fees\_collected\_msat** (msat): Total routing fees collected by this node
- **address** (array of objects): The addresses we announce to the world:
- **type** (string): Type of connection (one of "dns", "ipv4", "ipv6", "torv2", "torv3", "websocket")
- **type** (string): Type of connection (until 23.08, `websocket` was also allowed) (one of "dns", "ipv4", "ipv6", "torv2", "torv3")
- **port** (u16): port number
If **type** is "dns", "ipv4", "ipv6", "torv2" or "torv3":
@ -132,4 +132,4 @@ RESOURCES
Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:ac7ea19a5294ebb8d8e0acaa3e813849ce1b1f7f8ef2f3e52a9ca22e5e5d82fc)
[comment]: # ( SHA256STAMP:60310adb57a49cb425a4b0d424f176a0ffa4de312ed07855b5e5611a44a64fcf)

View file

@ -38,7 +38,7 @@ If **last\_timestamp** is present:
- **color** (hex): The favorite RGB color this node advertized (always 6 characters)
- **features** (hex): BOLT #9 features bitmap this node advertized
- **addresses** (array of objects): The addresses this node advertized:
- **type** (string): Type of connection (one of "dns", "ipv4", "ipv6", "torv2", "torv3", "websocket")
- **type** (string): Type of connection (until 23.08, `websocket` was also allowed) (one of "dns", "ipv4", "ipv6", "torv2", "torv3")
- **port** (u16): port number
If **type** is "dns", "ipv4", "ipv6", "torv2" or "torv3":
@ -100,4 +100,4 @@ RESOURCES
Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:99d22f32acd7d5181f731342d7b9245cfa17cc4257c1f87d78eb809fe7c6931d)
[comment]: # ( SHA256STAMP:f7177be7c118fecf2e701d45140ad2714a42b746871caa8cd89e42bdc466d21c)

View file

@ -116,10 +116,9 @@
"ipv4",
"ipv6",
"torv2",
"torv3",
"websocket"
"torv3"
],
"description": "Type of connection"
"description": "Type of connection (until 23.08, `websocket` was also allowed)"
},
"port": {
"type": "u16",

View file

@ -78,10 +78,9 @@
"ipv4",
"ipv6",
"torv2",
"torv3",
"websocket"
"torv3"
],
"description": "Type of connection"
"description": "Type of connection (until 23.08, `websocket` was also allowed)"
},
"port": {
"type": "u16",

View file

@ -397,7 +397,6 @@ static void handle_discovered_ip(struct daemon *daemon, const u8 *msg)
case ADDR_TYPE_TOR_V2_REMOVED:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_DNS:
case ADDR_TYPE_WEBSOCKET:
break;
}
return;

View file

@ -1360,7 +1360,6 @@ static void update_remote_addr(struct lightningd *ld,
case ADDR_TYPE_TOR_V2_REMOVED:
case ADDR_TYPE_TOR_V3:
case ADDR_TYPE_DNS:
case ADDR_TYPE_WEBSOCKET:
break;
}
}