Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
修订gui代码,修正闪退问题
Browse files Browse the repository at this point in the history
  • Loading branch information
e1732a364fed committed Dec 28, 2022
1 parent 4be50f1 commit 1c1a221
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions cmd/verysimple/gui_conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ func addConfControls(sc proxy.StandardConf, vb *ui.Box, isDial bool) {

{
setUuid := func() {
if curSelectedTagIdx < 0 {
return
}
if isDial {
sc.Dial[curSelectedTagIdx].UUID = uuidE.Text()
} else {
Expand Down Expand Up @@ -328,6 +331,9 @@ func addConfControls(sc proxy.StandardConf, vb *ui.Box, isDial bool) {
})

tagE.OnChanged(func(e *ui.Entry) {
if curSelectedTagIdx < 0 {
return
}
if isDial {
sc.Dial[curSelectedTagIdx].Tag = tagE.Text()
} else {
Expand All @@ -337,6 +343,9 @@ func addConfControls(sc proxy.StandardConf, vb *ui.Box, isDial bool) {
})

hostE.OnChanged(func(e *ui.Entry) {
if curSelectedTagIdx < 0 {
return
}
if isDial {
sc.Dial[curSelectedTagIdx].Host = hostE.Text()
} else {
Expand All @@ -345,6 +354,9 @@ func addConfControls(sc proxy.StandardConf, vb *ui.Box, isDial bool) {
})

ipE.OnChanged(func(e *ui.Entry) {
if curSelectedTagIdx < 0 {
return
}
if isDial {
sc.Dial[curSelectedTagIdx].IP = ipE.Text()
} else {
Expand All @@ -353,6 +365,9 @@ func addConfControls(sc proxy.StandardConf, vb *ui.Box, isDial bool) {
})

portE.OnChanged(func(s *ui.Spinbox) {
if curSelectedTagIdx < 0 {
return
}
if isDial {
sc.Dial[curSelectedTagIdx].Port = portE.Value()
} else {
Expand All @@ -361,6 +376,9 @@ func addConfControls(sc proxy.StandardConf, vb *ui.Box, isDial bool) {
})

tlsC.OnToggled(func(c *ui.Checkbox) {
if curSelectedTagIdx < 0 {
return
}
if isDial {
sc.Dial[curSelectedTagIdx].TLS = tlsC.Checked()
} else {
Expand All @@ -370,6 +388,9 @@ func addConfControls(sc proxy.StandardConf, vb *ui.Box, isDial bool) {
})

tlsInsC.OnToggled(func(c *ui.Checkbox) {
if curSelectedTagIdx < 0 {
return
}
if isDial {
sc.Dial[curSelectedTagIdx].Insecure = tlsInsC.Checked()
} else {
Expand All @@ -379,10 +400,16 @@ func addConfControls(sc proxy.StandardConf, vb *ui.Box, isDial bool) {

if !isDial {
keyE.OnChanged(func(e *ui.Entry) {
if curSelectedTagIdx < 0 {
return
}
sc.Listen[curSelectedTagIdx].TLSKey = keyE.Text()
})

certE.OnChanged(func(e *ui.Entry) {
if curSelectedTagIdx < 0 {
return
}
sc.Listen[curSelectedTagIdx].TLSCert = certE.Text()
})
}
Expand Down Expand Up @@ -424,6 +451,9 @@ func addConfControls(sc proxy.StandardConf, vb *ui.Box, isDial bool) {
})

pathE.OnChanged(func(e *ui.Entry) {
if curSelectedTagIdx < 0 {
return
}
if isDial {
sc.Dial[curSelectedTagIdx].Path = pathE.Text()
} else {
Expand All @@ -432,6 +462,9 @@ func addConfControls(sc proxy.StandardConf, vb *ui.Box, isDial bool) {
})

earlyC.OnToggled(func(c *ui.Checkbox) {
if curSelectedTagIdx < 0 {
return
}
if isDial {
sc.Dial[curSelectedTagIdx].IsEarly = earlyC.Checked()
} else {
Expand Down

0 comments on commit 1c1a221

Please sign in to comment.