mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-03-01 01:20:49 +03:00
bash - set or reset listenIP
we need this if we want to add SSH port forwarding
This commit is contained in:
parent
d40fa46851
commit
5ae587ee81
15
main.go
15
main.go
@ -216,7 +216,7 @@ func updateTgbotSetting(tgBotToken string, tgBotChatid string, tgBotRuntime stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateSetting(port int, username string, password string, webBasePath string) {
|
func updateSetting(port int, username string, password string, webBasePath string, listenIP string) {
|
||||||
err := database.InitDB(config.GetDBPath())
|
err := database.InitDB(config.GetDBPath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Database initialization failed:", err)
|
fmt.Println("Database initialization failed:", err)
|
||||||
@ -252,6 +252,15 @@ func updateSetting(port int, username string, password string, webBasePath strin
|
|||||||
fmt.Println("Base URI path set successfully")
|
fmt.Println("Base URI path set successfully")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if listenIP != "" {
|
||||||
|
err := settingService.SetListen(listenIP)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Failed to set listen IP:", err)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("listen %v set successfully", listenIP)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateCert(publicKey string, privateKey string) {
|
func updateCert(publicKey string, privateKey string) {
|
||||||
@ -339,6 +348,7 @@ func main() {
|
|||||||
var username string
|
var username string
|
||||||
var password string
|
var password string
|
||||||
var webBasePath string
|
var webBasePath string
|
||||||
|
var listenIP string
|
||||||
var webCertFile string
|
var webCertFile string
|
||||||
var webKeyFile string
|
var webKeyFile string
|
||||||
var tgbottoken string
|
var tgbottoken string
|
||||||
@ -355,6 +365,7 @@ func main() {
|
|||||||
settingCmd.StringVar(&username, "username", "", "Set login username")
|
settingCmd.StringVar(&username, "username", "", "Set login username")
|
||||||
settingCmd.StringVar(&password, "password", "", "Set login password")
|
settingCmd.StringVar(&password, "password", "", "Set login password")
|
||||||
settingCmd.StringVar(&webBasePath, "webBasePath", "", "Set base path for Panel")
|
settingCmd.StringVar(&webBasePath, "webBasePath", "", "Set base path for Panel")
|
||||||
|
settingCmd.StringVar(&listenIP, "listen", "", "set panel listen IP")
|
||||||
settingCmd.StringVar(&webCertFile, "webCert", "", "Set path to public key file for panel")
|
settingCmd.StringVar(&webCertFile, "webCert", "", "Set path to public key file for panel")
|
||||||
settingCmd.StringVar(&webKeyFile, "webCertKey", "", "Set path to private key file for panel")
|
settingCmd.StringVar(&webKeyFile, "webCertKey", "", "Set path to private key file for panel")
|
||||||
settingCmd.StringVar(&tgbottoken, "tgbottoken", "", "Set token for Telegram bot")
|
settingCmd.StringVar(&tgbottoken, "tgbottoken", "", "Set token for Telegram bot")
|
||||||
@ -397,7 +408,7 @@ func main() {
|
|||||||
if reset {
|
if reset {
|
||||||
resetSetting()
|
resetSetting()
|
||||||
} else {
|
} else {
|
||||||
updateSetting(port, username, password, webBasePath)
|
updateSetting(port, username, password, webBasePath, listenIP)
|
||||||
}
|
}
|
||||||
if show {
|
if show {
|
||||||
showSetting(show)
|
showSetting(show)
|
||||||
|
@ -243,6 +243,10 @@ func (s *SettingService) GetListen() (string, error) {
|
|||||||
return s.getString("webListen")
|
return s.getString("webListen")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *SettingService) SetListen(ip string) error {
|
||||||
|
return s.setString("webListen", ip)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *SettingService) GetWebDomain() (string, error) {
|
func (s *SettingService) GetWebDomain() (string, error) {
|
||||||
return s.getString("webDomain")
|
return s.getString("webDomain")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user