libtailscale: call hostinfo.SetApp

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
David Crawshaw
2023-03-04 16:16:14 -08:00
committed by David Crawshaw
parent 843d93cb63
commit 56cb66829f
2 changed files with 10 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ import (
"syscall"
"unsafe"
"tailscale.com/hostinfo"
"tailscale.com/tsnet"
"tailscale.com/types/logger"
)
@@ -85,6 +86,7 @@ func TsnetNewServer() C.int {
if servers.m == nil {
servers.m = map[C.int]*server{}
hostinfo.SetApp("libtailscale")
}
if servers.next == 0 {
servers.next = 42<<16 + 1

View File

@@ -132,6 +132,7 @@ int close_conn() {
*/
import "C"
import (
"context"
"flag"
"io"
"net/http"
@@ -139,6 +140,7 @@ import (
"os"
"path/filepath"
"testing"
"time"
"tailscale.com/net/netns"
"tailscale.com/tstest/integration"
@@ -183,7 +185,12 @@ func RunTestConn(t *testing.T) {
t.Fatal(C.GoString(C.err))
}
req, err := http.NewRequest("GET", "http://"+C.GoString(C.addr)+"/localapi/v0/status", nil)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
localAPIStatus := "http://" + C.GoString(C.addr) + "/localapi/v0/status"
t.Logf("fetching local API status from %q", localAPIStatus)
req, err := http.NewRequestWithContext(ctx, "GET", localAPIStatus, nil)
if err != nil {
t.Fatal(err)
}