Skip to content

Commit 5d26496

Browse files
author
gluck
committed
transport: remove HTTPEndpoint and Remote(), which nothing called
Written before the peer-model redirect put remoting in the daemon rather than the CLI, and dead ever since: no caller in the tree. Endpoint.Bearer stays -- the tunnel dialer presents it -- but the URL parsing and the is-this-remote predicate were speculative surface for a design that changed. When the daemon grows a peer registry it can mint endpoints in whatever shape that registry wants.
1 parent ad32eaf commit 5d26496

1 file changed

Lines changed: 3 additions & 24 deletions

File tree

‎api/transport/transport.go‎

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,14 @@ import (
1919
type Endpoint struct {
2020
Scheme string `json:"scheme"`
2121
Address string `json:"address"`
22-
// Bearer is the credential presented when Scheme is http(s). It is
23-
// carried on the Endpoint rather than looked up at dial time so that
24-
// exactly one place -- the CLI's origin resolver -- decides which secret
25-
// belongs to which host, and nothing below this line reads a keyring.
22+
// Bearer is the credential presented when Scheme is http(s).
2623
//
2724
// It is never serialized: a credential has no business in the JSON an
28-
// endpoint travels as (attach responses hand endpoints back to clients).
25+
// endpoint travels as, and attach responses hand endpoints back to
26+
// clients.
2927
Bearer string `json:"-"`
3028
}
3129

32-
// Remote reports whether this endpoint leaves the machine. A remote daemon is
33-
// never auto-started, and pid bindings are meaningless against one.
34-
func (e Endpoint) Remote() bool {
35-
return e.Scheme == "http" || e.Scheme == "https"
36-
}
37-
38-
// HTTPEndpoint constructs a gateway endpoint from a base URL.
39-
func HTTPEndpoint(rawURL, bearer string) (Endpoint, error) {
40-
u := strings.TrimRight(rawURL, "/")
41-
switch {
42-
case strings.HasPrefix(u, "https://"):
43-
return Endpoint{Scheme: "https", Address: strings.TrimPrefix(u, "https://"), Bearer: bearer}, nil
44-
case strings.HasPrefix(u, "http://"):
45-
return Endpoint{Scheme: "http", Address: strings.TrimPrefix(u, "http://"), Bearer: bearer}, nil
46-
default:
47-
return Endpoint{}, fmt.Errorf("origin %q: want an http:// or https:// URL", rawURL)
48-
}
49-
}
50-
5130
// UnixEndpoint is a convenience constructor for unix socket endpoints.
5231
func UnixEndpoint(path string) Endpoint {
5332
return Endpoint{Scheme: "unix", Address: path}

0 commit comments

Comments
 (0)