feat(nathole): add flag for STUN server in nathole discovery command (#3383)

This commit is contained in:
fatedier 2023-03-30 22:02:00 +08:00 committed by GitHub
parent 3faae194d0
commit 2c2c4ecdbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,11 +26,15 @@ import (
"github.com/fatedier/frp/pkg/nathole"
)
var natHoleSTUNServer string
func init() {
RegisterCommonFlags(natholeCmd)
rootCmd.AddCommand(natholeCmd)
natholeCmd.AddCommand(natholeDiscoveryCmd)
natholeCmd.PersistentFlags().StringVarP(&natHoleSTUNServer, "nat_hole_stun_server", "", "", "STUN server address for nathole")
}
var natholeCmd = &cobra.Command{
@ -47,6 +51,9 @@ var natholeDiscoveryCmd = &cobra.Command{
fmt.Println(err)
os.Exit(1)
}
if natHoleSTUNServer != "" {
cfg.NatHoleSTUNServer = natHoleSTUNServer
}
if err := validateForNatHoleDiscovery(cfg); err != nil {
fmt.Println(err)