提交 9d4430c1 编写于 作者: J Jason

优化

上级 5d760056
......@@ -20,8 +20,7 @@ func Tunnels() []Tunnel {
}
func Recovery() error {
//TODO 改为 加载模型,创建通道
var cs []models.ModelAdapter
var cs []models.Tunnel
err := db.Engine.Find(&cs)
if err != nil {
return err
......
......@@ -151,10 +151,9 @@ func newLink(ch Tunnel, conn net.Conn) *Link {
c := ch.GetTunnel()
return &Link{
Link: models.Link{
Id: 0,
TunnelId: c.Id,
//ModelTunnelId: c.ModelId,
Active: true,
ModelId: c.ModelId,
Active: true,
},
tunnel: ch,
conn: conn,
......@@ -166,8 +165,8 @@ func newPacketLink(ch Tunnel, conn net.PacketConn, addr net.Addr) *Link {
c := ch.GetTunnel()
return &Link{
Link: models.Link{
Id: 0,
TunnelId: c.Id,
ModelId: c.ModelId,
Active: true,
},
tunnel: ch,
......
......@@ -42,7 +42,7 @@ type ModelTunnel struct {
HeartBeatContent string `json:"heart_beat_content"`
HeartBeatIsHex bool `json:"heart_beat_is_hex"`
Protocol string `json:"protocol"`
ProtocolName string `json:"protocol"`
ProtocolOpts string `json:"protocol_opts"`
PollingEnable bool `json:"polling_enable"` //轮询
......@@ -52,7 +52,7 @@ type ModelTunnel struct {
type ModelVariable struct {
ModelBase
Tunnel string `json:"tunnel"`
models.Address
......@@ -71,7 +71,7 @@ type ModelVariable struct {
type ModelBatch struct {
ModelBase
Tunnel string `json:"tunnel"`
models.Address `xorm:"extends"`
......@@ -86,7 +86,7 @@ type ModelBatch struct {
type ModelJob struct {
ModelBase
Cron string `json:"cron"`
Script string `json:"script"` //javascript
}
......@@ -129,7 +129,7 @@ func modelImport(ctx *gin.Context) {
Name: t.Name,
Description: t.Description,
},
Protocol: t.Protocol,
ProtocolName: t.ProtocolName,
ProtocolOpts: t.ProtocolOpts,
PollingEnable: t.PollingEnable,
PollingInterval: t.PollingInterval,
......@@ -270,7 +270,7 @@ func modelExport(ctx *gin.Context) {
Name: v.Name,
Description: v.Description,
},
Protocol: v.Protocol,
ProtocolName: v.ProtocolName,
ProtocolOpts: v.ProtocolOpts,
PollingEnable: v.PollingEnable,
PollingInterval: v.PollingInterval,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册