Skip to content

Commit

Permalink
Do the needful
Browse files Browse the repository at this point in the history
  • Loading branch information
KristopherPaulsen committed Oct 15, 2024
1 parent 57e91a6 commit 7bf500c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 0 deletions.
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

0 comments on commit 7bf500c

Please sign in to comment.