Skip to content

Commit 0695509

Browse files
committed
API documentation + much more specific name
1 parent c961d42 commit 0695509

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

tailscale.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern int TsnetGetIps(int sd, char *buf, size_t buflen);
2323
extern int TsnetGetRemoteAddr(int listener, int conn, char *buf, size_t buflen);
2424
extern int TsnetListen(int sd, char* net, char* addr, int* listenerOut);
2525
extern int TsnetLoopback(int sd, char* addrOut, size_t addrLen, char* proxyOut, char* localOut);
26-
extern int TsnetEnableFunnel(int sd, int srvPort);
26+
extern int TsnetEnableFunnelToLocalhostPlaintextHttp1(int sd, int srvPort);
2727

2828
tailscale tailscale_new() {
2929
return TsnetNewServer();
@@ -108,6 +108,6 @@ int tailscale_errmsg(tailscale sd, char* buf, size_t buflen) {
108108
return TsnetErrmsg(sd, buf, buflen);
109109
}
110110

111-
int tailscale_enable_funnel(tailscale sd, int srvPort) {
112-
return TsnetEnableFunnel(sd, srvPort);
111+
int tailscale_enable_funnel_to_localhost_plaintext_http1(tailscale sd, int srvPort) {
112+
return TsnetEnableFunnelToLocalhostPlaintextHttp1(sd, srvPort);
113113
}

tailscale.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,8 @@ func TsnetLoopback(sd C.int, addrOut *C.char, addrLen C.size_t, proxyOut *C.char
534534
return 0
535535
}
536536

537-
//export TsnetEnableFunnel
538-
func TsnetEnableFunnel(sd C.int, srvPort C.int) C.int {
537+
//export TsnetEnableFunnelToLocalhostPlaintextHttp1
538+
func TsnetEnableFunnelToLocalhostPlaintextHttp1(sd C.int, srvPort C.int) C.int {
539539
s, err := getServer(sd)
540540
if err != nil {
541541
return s.recErr(err)

tailscale.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,21 @@ extern int tailscale_accept(tailscale_listener listener, tailscale_conn* conn_ou
175175
// Returns zero on success or -1 on error, call tailscale_errmsg for details.
176176
extern int tailscale_loopback(tailscale sd, char* addr_out, size_t addrlen, char* proxy_cred_out, char* local_api_cred_out);
177177

178-
// tailscale_enable_funnel creates a funnel for a given server port.
178+
// tailscale_enable_funnel_to_localhost_plaintext_http1 configures sd to have
179+
// Tailscale Funnel enabled, routing requests from the public web
180+
// (without any authentication) down to this Tailscale node, requesting new
181+
// LetsEncrypt TLS certs as needed, terminating TLS, and proxying all incoming
182+
// HTTPS requests to http://127.0.0.1:localhostPort without TLS.
183+
//
184+
// There should be a plaintext HTTP/1 server listening on 127.0.0.1:localhostPort
185+
// or tsnet will serve HTTP 502 errors.
186+
//
187+
// Expect junk traffic from the internet from bots watching the public CT logs.
179188
//
180189
// Returns:
181190
// 0 - success
182191
// -1 - other error, details printed to the tsnet logger
183-
extern int tailscale_enable_funnel(tailscale sd, int srvPort);
192+
extern int tailscale_enable_funnel_to_localhost_plaintext_http1(tailscale sd, int srvPort);
184193

185194
// tailscale_errmsg writes the details of the last error to buf.
186195
//

0 commit comments

Comments
 (0)