mirror of
https://github.com/urbit/vere.git
synced 2024-10-03 22:57:14 +03:00
Revert "ames: add libnatpmp for automatic port forwarding"
This commit is contained in:
parent
639d032b74
commit
385bdf9b85
@ -217,15 +217,6 @@ versioned_http_file(
|
||||
version = "721fa05",
|
||||
)
|
||||
|
||||
versioned_http_archive(
|
||||
name = "natpmp",
|
||||
build_file = "//bazel/third_party/natpmp:natpmp.BUILD",
|
||||
sha256 = "0684ed2c8406437e7519a1bd20ea83780db871b3a3a5d752311ba3e889dbfc70",
|
||||
strip_prefix = "libnatpmp-{version}",
|
||||
url = "http://miniupnp.free.fr/files/libnatpmp-{version}.tar.gz",
|
||||
version = "20230423",
|
||||
)
|
||||
|
||||
versioned_http_file(
|
||||
name = "solid_pill",
|
||||
sha256 = "8b658fcee6978e2b19004a54233cab953e77ea0bb6c3a04d1bfda4ddc6be63c5",
|
||||
|
0
bazel/third_party/natpmp/BUILD.bazel
vendored
0
bazel/third_party/natpmp/BUILD.bazel
vendored
8
bazel/third_party/natpmp/natpmp.BUILD
vendored
8
bazel/third_party/natpmp/natpmp.BUILD
vendored
@ -1,8 +0,0 @@
|
||||
cc_library(
|
||||
name = "natpmp",
|
||||
srcs = ["natpmp.c", "getgateway.c"],
|
||||
hdrs = ["natpmp.h", "getgateway.h", "natpmp_declspec.h"],
|
||||
copts = ["-O3"],
|
||||
linkstatic = True,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
@ -140,7 +140,6 @@ vere_library(
|
||||
"@lmdb",
|
||||
"@openssl",
|
||||
"@uv",
|
||||
"@natpmp",
|
||||
] + select({
|
||||
"@platforms//os:macos": [],
|
||||
"@platforms//os:linux": [
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "ur.h"
|
||||
|
||||
#include "zlib.h"
|
||||
#include "natpmp.h"
|
||||
|
||||
#include <ent.h>
|
||||
|
||||
@ -72,11 +71,6 @@ typedef enum u3_stun_state {
|
||||
u3_lane sef_u; // our lane, if we know it
|
||||
c3_o wok_o; // STUN worked, set on first success
|
||||
} sun_u; //
|
||||
struct {
|
||||
natpmp_t req_u; // libnatpmp struct for mapping request
|
||||
uv_poll_t pol_u; // handle waits on libnatpmp socket
|
||||
uv_timer_t tim_u; // every two hours if mapping succeeds
|
||||
} nat_u; // libnatpmp stuff for port forwarding
|
||||
c3_o nal_o; // lane cache backcompat flag
|
||||
struct { // config:
|
||||
c3_o net_o; // can send
|
||||
@ -2771,51 +2765,6 @@ _ames_recv_cb(uv_udp_t* wax_u,
|
||||
}
|
||||
}
|
||||
|
||||
static void natpmp_init(uv_timer_t* handle);
|
||||
|
||||
static void
|
||||
natpmp_cb(uv_poll_t* handle,
|
||||
c3_i status,
|
||||
c3_i events)
|
||||
{
|
||||
u3_ames* sam_u = handle->data;
|
||||
|
||||
natpmpresp_t response;
|
||||
c3_i res_i = readnatpmpresponseorretry(&sam_u->nat_u.req_u, &response);
|
||||
if ( NATPMP_TRYAGAIN == res_i ) {
|
||||
return;
|
||||
}
|
||||
|
||||
uv_poll_stop(handle);
|
||||
|
||||
if ( 0 != res_i ) {
|
||||
u3l_log("ames: natpmp error %i", res_i);
|
||||
closenatpmp(&sam_u->nat_u.req_u);
|
||||
return;
|
||||
}
|
||||
|
||||
u3l_log("ames: mapped public port %hu to localport %hu lifetime %u",
|
||||
response.pnu.newportmapping.mappedpublicport,
|
||||
response.pnu.newportmapping.privateport,
|
||||
response.pnu.newportmapping.lifetime);
|
||||
|
||||
closenatpmp(&sam_u->nat_u.req_u);
|
||||
sam_u->nat_u.tim_u.data = sam_u;
|
||||
uv_timer_start(&sam_u->nat_u.tim_u, natpmp_init, 7200000, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
natpmp_init(uv_timer_t *handle)
|
||||
{
|
||||
u3_ames* sam_u = handle->data;
|
||||
c3_s por_s = sam_u->pir_u->por_s;
|
||||
|
||||
sendnewportmappingrequest(&sam_u->nat_u.req_u, NATPMP_PROTOCOL_UDP, por_s, por_s, 7200);
|
||||
|
||||
sam_u->nat_u.pol_u.data = sam_u;
|
||||
uv_poll_start(&sam_u->nat_u.pol_u, UV_READABLE, natpmp_cb);
|
||||
}
|
||||
|
||||
static void
|
||||
_mdns_dear_bail(u3_ovum* egg_u, u3_noun lud)
|
||||
{
|
||||
@ -2936,11 +2885,6 @@ _ames_io_start(u3_ames* sam_u)
|
||||
u3z(our);
|
||||
|
||||
mdns_init(por_s, !sam_u->pir_u->fak_o, our_s, _ames_put_dear, (void *)sam_u);
|
||||
|
||||
if ( c3n == sam_u->pir_u->fak_o ) {
|
||||
uv_timer_start(&sam_u->nat_u.tim_u, natpmp_init, 0, 0);
|
||||
}
|
||||
|
||||
c3_free(our_s);
|
||||
}
|
||||
|
||||
@ -3284,12 +3228,6 @@ u3_ames_io_init(u3_pier* pir_u)
|
||||
sam_u->sun_u.tim_u.data = sam_u;
|
||||
sam_u->sun_u.dns_u.data = sam_u;
|
||||
|
||||
// initialize libnatpmp
|
||||
sam_u->nat_u.tim_u.data = sam_u;
|
||||
initnatpmp(&sam_u->nat_u.req_u, 0, 0);
|
||||
uv_timer_init(u3L, &sam_u->nat_u.tim_u);
|
||||
uv_poll_init(u3L, &sam_u->nat_u.pol_u, sam_u->nat_u.req_u.s);
|
||||
|
||||
// enable forwarding on galaxies only
|
||||
u3_noun who = u3i_chubs(2, sam_u->pir_u->who_d);
|
||||
u3_noun rac = u3do("clan:title", who);
|
||||
|
Loading…
Reference in New Issue
Block a user