TUN-4521: Modify cloudflared to use zoneless-tunnels-worker for free tunnels

This commit is contained in:
Rishabh Bector
2021-06-21 19:31:24 -05:00
committed by Nuno Diegues
parent 8d99e92852
commit 3eb9efd9f0
3 changed files with 101 additions and 3 deletions

View File

@@ -58,7 +58,7 @@ func (o *Observer) logTrialHostname(registration *tunnelpogs.TunnelRegistration)
// Print out the user's trial zone URL in a nice box (if they requested and got one and UI flag is not set)
if !o.uiEnabled {
if registrationURL, err := url.Parse(registration.Url); err == nil {
for _, line := range asciiBox(trialZoneMsg(registrationURL.String()), 2) {
for _, line := range AsciiBox(TrialZoneMsg(registrationURL.String()), 2) {
o.log.Info().Msg(line)
}
} else {
@@ -70,7 +70,7 @@ func (o *Observer) logTrialHostname(registration *tunnelpogs.TunnelRegistration)
}
// Print out the given lines in a nice ASCII box.
func asciiBox(lines []string, padding int) (box []string) {
func AsciiBox(lines []string, padding int) (box []string) {
maxLen := maxLen(lines)
spacer := strings.Repeat(" ", padding)
@@ -94,7 +94,7 @@ func maxLen(lines []string) int {
return max
}
func trialZoneMsg(url string) []string {
func TrialZoneMsg(url string) []string {
return []string{
"Your free tunnel has started! Visit it:",
" " + url,