Emscripten: wss support
GitOrigin-RevId: 06ce89660769533f531726b74573a1a422be20d0
This commit is contained in:
parent
09712039f5
commit
cab28f2cc8
@ -82,8 +82,8 @@ if (EMSCRIPTEN)
|
||||
set(ZLIB_LIBRARIES)
|
||||
set(ZLIB_INCLUDE_DIR)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -s ALLOW_MEMORY_GROWTH=1 -s USE_ZLIB=1 -s MODULARIZE=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS']\"")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -s ALLOW_MEMORY_GROWTH=1 -s USE_ZLIB=1 -s MODULARIZE=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS']\"")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -s ALLOW_MEMORY_GROWTH=1 -s USE_ZLIB=1 -s MODULARIZE=1 -s WEBSOCKET_URL=\"'wss:#'\" -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS']\"")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -s ALLOW_MEMORY_GROWTH=1 -s USE_ZLIB=1 -s MODULARIZE=1 -s WEBSOCKET_URL=\"'wss:#'\" -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS']\"")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=1")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=1")
|
||||
|
||||
|
@ -1263,14 +1263,22 @@ void ConnectionCreator::hangup() {
|
||||
|
||||
DcOptions ConnectionCreator::get_default_dc_options(bool is_test) {
|
||||
DcOptions res;
|
||||
auto add_ip_ports = [&res](int32 dc_id, const vector<string> &ips, const vector<int> &ports, bool is_ipv6 = false) {
|
||||
enum class HostType { IPv4, IPv6, Url };
|
||||
auto add_ip_ports = [&res](int32 dc_id, const vector<string> &ips, const vector<int> &ports,
|
||||
HostType type = HostType::IPv4) {
|
||||
IPAddress ip_address;
|
||||
for (auto &ip : ips) {
|
||||
for (auto port : ports) {
|
||||
if (is_ipv6) {
|
||||
ip_address.init_ipv6_port(ip, port).ensure();
|
||||
} else {
|
||||
ip_address.init_ipv4_port(ip, port).ensure();
|
||||
switch (type) {
|
||||
case HostType::IPv4:
|
||||
ip_address.init_ipv4_port(ip, port).ensure();
|
||||
break;
|
||||
case HostType::IPv6:
|
||||
ip_address.init_ipv6_port(ip, port).ensure();
|
||||
break;
|
||||
case HostType::Url:
|
||||
ip_address.init_host_port(ip, port).ensure();
|
||||
break;
|
||||
}
|
||||
res.dc_options.emplace_back(DcId::internal(dc_id), ip_address);
|
||||
}
|
||||
@ -1282,9 +1290,9 @@ DcOptions ConnectionCreator::get_default_dc_options(bool is_test) {
|
||||
add_ip_ports(2, {"149.154.167.40"}, ports);
|
||||
add_ip_ports(3, {"149.154.175.117"}, ports);
|
||||
|
||||
add_ip_ports(1, {"2001:b28:f23d:f001::e"}, ports, true);
|
||||
add_ip_ports(2, {"2001:67c:4e8:f002::e"}, ports, true);
|
||||
add_ip_ports(3, {"2001:b28:f23d:f003::e"}, ports, true);
|
||||
add_ip_ports(1, {"2001:b28:f23d:f001::e"}, ports, HostType::IPv6);
|
||||
add_ip_ports(2, {"2001:67c:4e8:f002::e"}, ports, HostType::IPv6);
|
||||
add_ip_ports(3, {"2001:b28:f23d:f003::e"}, ports, HostType::IPv6);
|
||||
} else {
|
||||
add_ip_ports(1, {"149.154.175.50"}, ports);
|
||||
add_ip_ports(2, {"149.154.167.51"}, ports);
|
||||
@ -1292,11 +1300,11 @@ DcOptions ConnectionCreator::get_default_dc_options(bool is_test) {
|
||||
add_ip_ports(4, {"149.154.167.91"}, ports);
|
||||
add_ip_ports(5, {"149.154.171.5"}, ports);
|
||||
|
||||
add_ip_ports(1, {"2001:b28:f23d:f001::a"}, ports, true);
|
||||
add_ip_ports(2, {"2001:67c:4e8:f002::a"}, ports, true);
|
||||
add_ip_ports(3, {"2001:b28:f23d:f003::a"}, ports, true);
|
||||
add_ip_ports(4, {"2001:67c:4e8:f004::a"}, ports, true);
|
||||
add_ip_ports(5, {"2001:b28:f23f:f005::a"}, ports, true);
|
||||
add_ip_ports(1, {"2001:b28:f23d:f001::a"}, ports, HostType::IPv6);
|
||||
add_ip_ports(2, {"2001:67c:4e8:f002::a"}, ports, HostType::IPv6);
|
||||
add_ip_ports(3, {"2001:b28:f23d:f003::a"}, ports, HostType::IPv6);
|
||||
add_ip_ports(4, {"2001:67c:4e8:f004::a"}, ports, HostType::IPv6);
|
||||
add_ip_ports(5, {"2001:b28:f23f:f005::a"}, ports, HostType::IPv6);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user