client/tailscale/apitype: move local API types to new apitype package

They were scattered/duplicated in misc places before.

It can't be in the client package itself for circular dep reasons.

This new package is basically tailcfg but for localhost
communications, instead of to control.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-04-13 08:13:46 -07:00
parent 1b9d8771dc
commit db5e269463
9 changed files with 61 additions and 43 deletions

View File

@@ -23,6 +23,7 @@ import (
"time"
"inet.af/netaddr"
"tailscale.com/client/tailscale/apitype"
"tailscale.com/ipn"
"tailscale.com/ipn/ipnlocal"
"tailscale.com/ipn/ipnstate"
@@ -143,7 +144,7 @@ func (h *Handler) serveWhoIs(w http.ResponseWriter, r *http.Request) {
http.Error(w, "no match for IP:port", 404)
return
}
res := &tailcfg.WhoIsResponse{
res := &apitype.WhoIsResponse{
Node: n,
UserProfile: &u,
}
@@ -340,7 +341,7 @@ func (h *Handler) serveFilePut(w http.ResponseWriter, r *http.Request) {
}
stableID, filenameEscaped := tailcfg.StableNodeID(upath[:slash]), upath[slash+1:]
var ft *ipnlocal.FileTarget
var ft *apitype.FileTarget
for _, x := range fts {
if x.Node.StableID == stableID {
ft = x