mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-28 13:59:58 +00:00
TUN-3449: Use flag to select transport protocol implementation
This commit is contained in:
@@ -719,6 +719,7 @@ func tunnelFlags(shouldHide bool) []cli.Flag {
|
||||
Value: false,
|
||||
Hidden: shouldHide,
|
||||
}),
|
||||
selectProtocolFlag,
|
||||
}...)
|
||||
|
||||
return flags
|
||||
|
@@ -260,12 +260,16 @@ func (sc *subcommandContext) run(tunnelID uuid.UUID) error {
|
||||
return err
|
||||
}
|
||||
|
||||
protocol, ok := origin.ParseProtocol(sc.c.String("protocol"))
|
||||
if !ok {
|
||||
return fmt.Errorf("%s is not valid protocol. %s", sc.c.String("protocol"), availableProtocol)
|
||||
}
|
||||
return StartServer(
|
||||
sc.c,
|
||||
version,
|
||||
shutdownC,
|
||||
graceShutdownC,
|
||||
&origin.NamedTunnelConfig{Auth: *credentials, ID: tunnelID},
|
||||
&origin.NamedTunnelConfig{Auth: *credentials, ID: tunnelID, Protocol: protocol},
|
||||
sc.logger,
|
||||
sc.isUIEnabled,
|
||||
)
|
||||
|
@@ -30,6 +30,7 @@ import (
|
||||
|
||||
const (
|
||||
credFileFlagAlias = "cred-file"
|
||||
availableProtocol = "Available protocols: http2, Go's implementation and h2mux, Cloudflare's implementation of HTTP/2."
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -83,6 +84,13 @@ var (
|
||||
Aliases: []string{"f"},
|
||||
Usage: "Allows you to delete a tunnel, even if it has active connections.",
|
||||
}
|
||||
selectProtocolFlag = &cli.StringFlag{
|
||||
Name: "protocol",
|
||||
Value: "h2mux",
|
||||
Aliases: []string{"p"},
|
||||
Usage: fmt.Sprintf("Protocol implementation to connect with Cloudflare's edge network. %s", availableProtocol),
|
||||
Hidden: true,
|
||||
}
|
||||
)
|
||||
|
||||
func buildCreateCommand() *cli.Command {
|
||||
@@ -309,6 +317,7 @@ func buildRunCommand() *cli.Command {
|
||||
flags := []cli.Flag{
|
||||
forceFlag,
|
||||
credentialsFileFlag,
|
||||
selectProtocolFlag,
|
||||
}
|
||||
flags = append(flags, configureProxyFlags(false)...)
|
||||
return &cli.Command{
|
||||
|
Reference in New Issue
Block a user