bandwidth_limit flags for sub cmds
This commit is contained in:
parent
2610994c85
commit
013092e9bd
@ -39,6 +39,8 @@ func init() {
|
|||||||
httpCmd.PersistentFlags().StringVarP(&hostHeaderRewrite, "host_header_rewrite", "", "", "host header rewrite")
|
httpCmd.PersistentFlags().StringVarP(&hostHeaderRewrite, "host_header_rewrite", "", "", "host header rewrite")
|
||||||
httpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
httpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
||||||
httpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
httpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
||||||
|
httpCmd.PersistentFlags().StringVarP(&bandwidthLimit, "bandwidth_limit", "", "", "bandwidth limit")
|
||||||
|
httpCmd.PersistentFlags().StringVarP(&bandwidthLimitMode, "bandwidth_limit_mode", "", config.BandwidthLimitModeClient, "bandwidth limit mode")
|
||||||
|
|
||||||
rootCmd.AddCommand(httpCmd)
|
rootCmd.AddCommand(httpCmd)
|
||||||
}
|
}
|
||||||
@ -70,6 +72,12 @@ var httpCmd = &cobra.Command{
|
|||||||
cfg.HostHeaderRewrite = hostHeaderRewrite
|
cfg.HostHeaderRewrite = hostHeaderRewrite
|
||||||
cfg.UseEncryption = useEncryption
|
cfg.UseEncryption = useEncryption
|
||||||
cfg.UseCompression = useCompression
|
cfg.UseCompression = useCompression
|
||||||
|
cfg.BandwidthLimit, err = config.NewBandwidthQuantity(bandwidthLimit)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
cfg.BandwidthLimitMode = bandwidthLimitMode
|
||||||
|
|
||||||
err = cfg.CheckForCli()
|
err = cfg.CheckForCli()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -35,6 +35,8 @@ func init() {
|
|||||||
httpsCmd.PersistentFlags().StringVarP(&subDomain, "sd", "", "", "sub domain")
|
httpsCmd.PersistentFlags().StringVarP(&subDomain, "sd", "", "", "sub domain")
|
||||||
httpsCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
httpsCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
||||||
httpsCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
httpsCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
||||||
|
httpsCmd.PersistentFlags().StringVarP(&bandwidthLimit, "bandwidth_limit", "", "", "bandwidth limit")
|
||||||
|
httpsCmd.PersistentFlags().StringVarP(&bandwidthLimitMode, "bandwidth_limit_mode", "", config.BandwidthLimitModeClient, "bandwidth limit mode")
|
||||||
|
|
||||||
rootCmd.AddCommand(httpsCmd)
|
rootCmd.AddCommand(httpsCmd)
|
||||||
}
|
}
|
||||||
@ -62,6 +64,12 @@ var httpsCmd = &cobra.Command{
|
|||||||
cfg.SubDomain = subDomain
|
cfg.SubDomain = subDomain
|
||||||
cfg.UseEncryption = useEncryption
|
cfg.UseEncryption = useEncryption
|
||||||
cfg.UseCompression = useCompression
|
cfg.UseCompression = useCompression
|
||||||
|
cfg.BandwidthLimit, err = config.NewBandwidthQuantity(bandwidthLimit)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
cfg.BandwidthLimitMode = bandwidthLimitMode
|
||||||
|
|
||||||
err = cfg.CheckForCli()
|
err = cfg.CheckForCli()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -54,24 +54,26 @@ var (
|
|||||||
logMaxDays int
|
logMaxDays int
|
||||||
disableLogColor bool
|
disableLogColor bool
|
||||||
|
|
||||||
proxyName string
|
proxyName string
|
||||||
localIP string
|
localIP string
|
||||||
localPort int
|
localPort int
|
||||||
remotePort int
|
remotePort int
|
||||||
useEncryption bool
|
useEncryption bool
|
||||||
useCompression bool
|
useCompression bool
|
||||||
customDomains string
|
bandwidthLimit string
|
||||||
subDomain string
|
bandwidthLimitMode string
|
||||||
httpUser string
|
customDomains string
|
||||||
httpPwd string
|
subDomain string
|
||||||
locations string
|
httpUser string
|
||||||
hostHeaderRewrite string
|
httpPwd string
|
||||||
role string
|
locations string
|
||||||
sk string
|
hostHeaderRewrite string
|
||||||
multiplexer string
|
role string
|
||||||
serverName string
|
sk string
|
||||||
bindAddr string
|
multiplexer string
|
||||||
bindPort int
|
serverName string
|
||||||
|
bindAddr string
|
||||||
|
bindPort int
|
||||||
|
|
||||||
tlsEnable bool
|
tlsEnable bool
|
||||||
)
|
)
|
||||||
|
@ -37,6 +37,8 @@ func init() {
|
|||||||
stcpCmd.PersistentFlags().IntVarP(&bindPort, "bind_port", "", 0, "bind port")
|
stcpCmd.PersistentFlags().IntVarP(&bindPort, "bind_port", "", 0, "bind port")
|
||||||
stcpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
stcpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
||||||
stcpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
stcpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
||||||
|
stcpCmd.PersistentFlags().StringVarP(&bandwidthLimit, "bandwidth_limit", "", "", "bandwidth limit")
|
||||||
|
stcpCmd.PersistentFlags().StringVarP(&bandwidthLimitMode, "bandwidth_limit_mode", "", config.BandwidthLimitModeClient, "bandwidth limit mode")
|
||||||
|
|
||||||
rootCmd.AddCommand(stcpCmd)
|
rootCmd.AddCommand(stcpCmd)
|
||||||
}
|
}
|
||||||
@ -70,6 +72,12 @@ var stcpCmd = &cobra.Command{
|
|||||||
cfg.Sk = sk
|
cfg.Sk = sk
|
||||||
cfg.LocalIP = localIP
|
cfg.LocalIP = localIP
|
||||||
cfg.LocalPort = localPort
|
cfg.LocalPort = localPort
|
||||||
|
cfg.BandwidthLimit, err = config.NewBandwidthQuantity(bandwidthLimit)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
cfg.BandwidthLimitMode = bandwidthLimitMode
|
||||||
err = cfg.CheckForCli()
|
err = cfg.CheckForCli()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
@ -37,6 +37,8 @@ func init() {
|
|||||||
sudpCmd.PersistentFlags().IntVarP(&bindPort, "bind_port", "", 0, "bind port")
|
sudpCmd.PersistentFlags().IntVarP(&bindPort, "bind_port", "", 0, "bind port")
|
||||||
sudpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
sudpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
||||||
sudpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
sudpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
||||||
|
sudpCmd.PersistentFlags().StringVarP(&bandwidthLimit, "bandwidth_limit", "", "", "bandwidth limit")
|
||||||
|
sudpCmd.PersistentFlags().StringVarP(&bandwidthLimitMode, "bandwidth_limit_mode", "", config.BandwidthLimitModeClient, "bandwidth limit mode")
|
||||||
|
|
||||||
rootCmd.AddCommand(sudpCmd)
|
rootCmd.AddCommand(sudpCmd)
|
||||||
}
|
}
|
||||||
@ -70,6 +72,12 @@ var sudpCmd = &cobra.Command{
|
|||||||
cfg.Sk = sk
|
cfg.Sk = sk
|
||||||
cfg.LocalIP = localIP
|
cfg.LocalIP = localIP
|
||||||
cfg.LocalPort = localPort
|
cfg.LocalPort = localPort
|
||||||
|
cfg.BandwidthLimit, err = config.NewBandwidthQuantity(bandwidthLimit)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
cfg.BandwidthLimitMode = bandwidthLimitMode
|
||||||
err = cfg.CheckForCli()
|
err = cfg.CheckForCli()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
@ -33,6 +33,8 @@ func init() {
|
|||||||
tcpCmd.PersistentFlags().IntVarP(&remotePort, "remote_port", "r", 0, "remote port")
|
tcpCmd.PersistentFlags().IntVarP(&remotePort, "remote_port", "r", 0, "remote port")
|
||||||
tcpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
tcpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
||||||
tcpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
tcpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
||||||
|
tcpCmd.PersistentFlags().StringVarP(&bandwidthLimit, "bandwidth_limit", "", "", "bandwidth limit")
|
||||||
|
tcpCmd.PersistentFlags().StringVarP(&bandwidthLimitMode, "bandwidth_limit_mode", "", config.BandwidthLimitModeClient, "bandwidth limit mode")
|
||||||
|
|
||||||
rootCmd.AddCommand(tcpCmd)
|
rootCmd.AddCommand(tcpCmd)
|
||||||
}
|
}
|
||||||
@ -59,6 +61,12 @@ var tcpCmd = &cobra.Command{
|
|||||||
cfg.RemotePort = remotePort
|
cfg.RemotePort = remotePort
|
||||||
cfg.UseEncryption = useEncryption
|
cfg.UseEncryption = useEncryption
|
||||||
cfg.UseCompression = useCompression
|
cfg.UseCompression = useCompression
|
||||||
|
cfg.BandwidthLimit, err = config.NewBandwidthQuantity(bandwidthLimit)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
cfg.BandwidthLimitMode = bandwidthLimitMode
|
||||||
|
|
||||||
err = cfg.CheckForCli()
|
err = cfg.CheckForCli()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -36,6 +36,8 @@ func init() {
|
|||||||
tcpMuxCmd.PersistentFlags().StringVarP(&multiplexer, "mux", "", "", "multiplexer")
|
tcpMuxCmd.PersistentFlags().StringVarP(&multiplexer, "mux", "", "", "multiplexer")
|
||||||
tcpMuxCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
tcpMuxCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
||||||
tcpMuxCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
tcpMuxCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
||||||
|
tcpMuxCmd.PersistentFlags().StringVarP(&bandwidthLimit, "bandwidth_limit", "", "", "bandwidth limit")
|
||||||
|
tcpMuxCmd.PersistentFlags().StringVarP(&bandwidthLimitMode, "bandwidth_limit_mode", "", config.BandwidthLimitModeClient, "bandwidth limit mode")
|
||||||
|
|
||||||
rootCmd.AddCommand(tcpMuxCmd)
|
rootCmd.AddCommand(tcpMuxCmd)
|
||||||
}
|
}
|
||||||
@ -64,6 +66,12 @@ var tcpMuxCmd = &cobra.Command{
|
|||||||
cfg.Multiplexer = multiplexer
|
cfg.Multiplexer = multiplexer
|
||||||
cfg.UseEncryption = useEncryption
|
cfg.UseEncryption = useEncryption
|
||||||
cfg.UseCompression = useCompression
|
cfg.UseCompression = useCompression
|
||||||
|
cfg.BandwidthLimit, err = config.NewBandwidthQuantity(bandwidthLimit)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
cfg.BandwidthLimitMode = bandwidthLimitMode
|
||||||
|
|
||||||
err = cfg.CheckForCli()
|
err = cfg.CheckForCli()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -33,6 +33,8 @@ func init() {
|
|||||||
udpCmd.PersistentFlags().IntVarP(&remotePort, "remote_port", "r", 0, "remote port")
|
udpCmd.PersistentFlags().IntVarP(&remotePort, "remote_port", "r", 0, "remote port")
|
||||||
udpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
udpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
||||||
udpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
udpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
||||||
|
udpCmd.PersistentFlags().StringVarP(&bandwidthLimit, "bandwidth_limit", "", "", "bandwidth limit")
|
||||||
|
udpCmd.PersistentFlags().StringVarP(&bandwidthLimitMode, "bandwidth_limit_mode", "", config.BandwidthLimitModeClient, "bandwidth limit mode")
|
||||||
|
|
||||||
rootCmd.AddCommand(udpCmd)
|
rootCmd.AddCommand(udpCmd)
|
||||||
}
|
}
|
||||||
@ -59,6 +61,12 @@ var udpCmd = &cobra.Command{
|
|||||||
cfg.RemotePort = remotePort
|
cfg.RemotePort = remotePort
|
||||||
cfg.UseEncryption = useEncryption
|
cfg.UseEncryption = useEncryption
|
||||||
cfg.UseCompression = useCompression
|
cfg.UseCompression = useCompression
|
||||||
|
cfg.BandwidthLimit, err = config.NewBandwidthQuantity(bandwidthLimit)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
cfg.BandwidthLimitMode = bandwidthLimitMode
|
||||||
|
|
||||||
err = cfg.CheckForCli()
|
err = cfg.CheckForCli()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -37,6 +37,8 @@ func init() {
|
|||||||
xtcpCmd.PersistentFlags().IntVarP(&bindPort, "bind_port", "", 0, "bind port")
|
xtcpCmd.PersistentFlags().IntVarP(&bindPort, "bind_port", "", 0, "bind port")
|
||||||
xtcpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
xtcpCmd.PersistentFlags().BoolVarP(&useEncryption, "ue", "", false, "use encryption")
|
||||||
xtcpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
xtcpCmd.PersistentFlags().BoolVarP(&useCompression, "uc", "", false, "use compression")
|
||||||
|
xtcpCmd.PersistentFlags().StringVarP(&bandwidthLimit, "bandwidth_limit", "", "", "bandwidth limit")
|
||||||
|
xtcpCmd.PersistentFlags().StringVarP(&bandwidthLimitMode, "bandwidth_limit_mode", "", config.BandwidthLimitModeClient, "bandwidth limit mode")
|
||||||
|
|
||||||
rootCmd.AddCommand(xtcpCmd)
|
rootCmd.AddCommand(xtcpCmd)
|
||||||
}
|
}
|
||||||
@ -70,6 +72,12 @@ var xtcpCmd = &cobra.Command{
|
|||||||
cfg.Sk = sk
|
cfg.Sk = sk
|
||||||
cfg.LocalIP = localIP
|
cfg.LocalIP = localIP
|
||||||
cfg.LocalPort = localPort
|
cfg.LocalPort = localPort
|
||||||
|
cfg.BandwidthLimit, err = config.NewBandwidthQuantity(bandwidthLimit)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
cfg.BandwidthLimitMode = bandwidthLimitMode
|
||||||
err = cfg.CheckForCli()
|
err = cfg.CheckForCli()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user