1
0
mirror of https://github.com/fumiama/terasu-cloudflared.git synced 2026-06-05 00:50:24 +08:00

TUN-5679: Add support for service install using Tunnel Token

This commit is contained in:
João Oliveirinha
2022-02-23 16:18:45 +00:00
parent c2a32de35f
commit 706523389c
6 changed files with 101 additions and 79 deletions

View File

@@ -644,7 +644,7 @@ func runCommand(c *cli.Context) error {
// Check if token is provided and if not use default tunnelID flag method
if tokenStr := c.String(TunnelTokenFlag); tokenStr != "" {
if token, err := parseToken(tokenStr); err == nil {
if token, err := ParseToken(tokenStr); err == nil {
return sc.runWithCredentials(token.Credentials())
}
@@ -663,7 +663,7 @@ func runCommand(c *cli.Context) error {
}
}
func parseToken(tokenStr string) (*connection.TunnelToken, error) {
func ParseToken(tokenStr string) (*connection.TunnelToken, error) {
content, err := base64.StdEncoding.DecodeString(tokenStr)
if err != nil {
return nil, err