修改隧道列表,增加远端名称字段

This commit is contained in:
lwch
2021-10-13 18:28:11 +08:00
parent d4626ce3ec
commit 3e5cd71bf5
6 changed files with 26 additions and 5 deletions
+6 -4
View File
@@ -15,15 +15,17 @@ func (db *Dashboard) Tunnels(w http.ResponseWriter, r *http.Request) {
RecvPacket uint64 `json:"recv_packet"`
}
type item struct {
Name string `json:"name"`
Port uint16 `json:"port"`
Type string `json:"type"`
Links []link `json:"links"`
Name string `json:"name"`
Remote string `json:"remote"`
Port uint16 `json:"port"`
Type string `json:"type"`
Links []link `json:"links"`
}
var ret []item
db.mgr.Range(func(t tunnel.Tunnel) {
var it item
it.Name = t.GetName()
it.Remote = t.GetRemote()
it.Port = t.GetPort()
it.Type = t.GetTypeName()
for _, l := range t.GetLinks() {
+1
View File
@@ -13,6 +13,7 @@ type Link interface {
// Tunnel tunnel interface
type Tunnel interface {
GetName() string
GetRemote() string
GetPort() uint16
GetTypeName() string
GetTarget() string
+5
View File
@@ -54,6 +54,11 @@ func (t *Tunnel) GetLinks() []tunnel.Link {
return ret
}
// GetRemote get remote target name
func (t *Tunnel) GetRemote() string {
return t.cfg.Target
}
// GetPort get listen port
func (t *Tunnel) GetPort() uint16 {
return t.cfg.LocalPort
+5
View File
@@ -55,6 +55,11 @@ func (shell *Shell) GetLinks() []tunnel.Link {
return ret
}
// GetRemote get remote target name
func (shell *Shell) GetRemote() string {
return shell.cfg.Target
}
// GetPort get listen port
func (shell *Shell) GetPort() uint16 {
return shell.cfg.LocalPort