Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plumb name field through for agent and cli flags #195

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type commonOpts struct {
// user supplied description of the endpoint
Description string

// user supplied name for the endpoint
Name string

// If not set, defaults to a URI in the format `app://hostname/path/to/executable?pid=12345`
ForwardsTo string

Expand Down
1 change: 1 addition & 0 deletions config/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func (cfg *httpOptions) WithForwardsTo(url *url.URL) {

func (cfg httpOptions) Extra() proto.BindExtra {
return proto.BindExtra{
Name: cfg.Name,
Metadata: cfg.Metadata,
Description: cfg.Description,
Bindings: cfg.Bindings,
Expand Down
1 change: 1 addition & 0 deletions config/labeled.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (cfg *labeledOptions) WithForwardsTo(url *url.URL) {

func (cfg labeledOptions) Extra() proto.BindExtra {
return proto.BindExtra{
Name: cfg.Name,
Metadata: cfg.Metadata,
Description: cfg.Description,
}
Expand Down
28 changes: 28 additions & 0 deletions config/name.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package config

type nameOption string

func WithName(name string) interface {
HTTPEndpointOption
TCPEndpointOption
TLSEndpointOption
LabeledTunnelOption
} {
return nameOption(name)
}

func (opt nameOption) ApplyHTTP(opts *httpOptions) {
opts.Name = string(opt)
}

func (opt nameOption) ApplyTLS(opts *tlsOptions) {
opts.Name = string(opt)
}

func (opt nameOption) ApplyTCP(opts *tcpOptions) {
opts.Name = string(opt)
}

func (opt nameOption) ApplyLabeled(opts *labeledOptions) {
opts.Name = string(opt)
}
1 change: 1 addition & 0 deletions config/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func (cfg *tcpOptions) WithForwardsTo(url *url.URL) {

func (cfg tcpOptions) Extra() proto.BindExtra {
return proto.BindExtra{
Name: cfg.Name,
Metadata: cfg.Metadata,
Description: cfg.Description,
Bindings: cfg.Bindings,
Expand Down
1 change: 1 addition & 0 deletions config/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func (cfg *tlsOptions) WithForwardsTo(url *url.URL) {

func (cfg tlsOptions) Extra() proto.BindExtra {
return proto.BindExtra{
Name: cfg.Name,
Metadata: cfg.Metadata,
Description: cfg.Description,
Bindings: cfg.Bindings,
Expand Down
1 change: 1 addition & 0 deletions internal/tunnel/proto/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ type Bind struct {
}

type BindExtra struct {
Name string
Token string
IPPolicyRef string
Metadata string
Expand Down
Loading