TUN-3220: tunnel route reports created route

This commit is contained in:
cthuang 2020-07-30 15:33:10 +01:00
parent edc69694cb
commit 1cbc8fb8ac
2 changed files with 12 additions and 0 deletions

View File

@ -548,6 +548,8 @@ func routeTunnel(c *cli.Context) error {
return errors.Wrap(err, "Failed to route tunnel")
}
logger.Infof(route.SuccessSummary())
return nil
}

View File

@ -44,6 +44,8 @@ type Connection struct {
type Route interface {
json.Marshaler
RecordType() string
// SuccessSummary explains what will route to this tunnel when it's provisioned successfully
SuccessSummary() string
}
type DNSRoute struct {
@ -71,6 +73,10 @@ func (dr *DNSRoute) RecordType() string {
return "dns"
}
func (dr *DNSRoute) SuccessSummary() string {
return fmt.Sprintf("%s will route to your tunnel", dr.userHostname)
}
type LBRoute struct {
lbName string
lbPool string
@ -100,6 +106,10 @@ func (lr *LBRoute) RecordType() string {
return "lb"
}
func (lr *LBRoute) SuccessSummary() string {
return fmt.Sprintf("Load balancer %s will route to this tunnel through pool %s", lr.lbName, lr.lbPool)
}
type Client interface {
CreateTunnel(name string, tunnelSecret []byte) (*Tunnel, error)
GetTunnel(tunnelID uuid.UUID) (*Tunnel, error)