package isapi import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "io/ioutil" "lcfns/isapi" ) //越界侦测 type LineDetectionApi struct { } // GetLineDetectionCap 获取单个通道越界侦测规则参数配置能力 func (api LineDetectionApi) GetLineDetectionCap(c *gin.Context) { host, err := GetHost(c) if err != nil { logrus.Errorf("获取host失败:%e\n", err) return } isapi.TouChuan(host, isapi.GetLineDetectionCap, nil, c) } // GetSizeLd 区域入侵 func (api LineDetectionApi) GetSizeLd(c *gin.Context) { host, err := GetHost(c) if err != nil { logrus.Errorf("获取host失败:%e\n", err) return } isapi.TouChuan(host, isapi.GetLineDetectionCal, nil, c) } func (api LineDetectionApi) PutSizeLd(c *gin.Context) { defer c.Request.Body.Close() data, err := ioutil.ReadAll(c.Request.Body) if err != nil { logrus.Errorf("读取数据失败:%e\n", err) return } host, err := GetHost(c) if err != nil { logrus.Errorf("获取host失败:%e\n", err) return } isapi.TouChuan(host, isapi.PutLineDetectionCal, data, c) } func (api LineDetectionApi) GetLineDetection(c *gin.Context) { host, err := GetHost(c) if err != nil { logrus.Errorf("获取host失败:%e\n", err) return } isapi.TouChuan(host, isapi.GetLineDetection, nil, c) } func (api LineDetectionApi) PutLineDetection(c *gin.Context) { defer c.Request.Body.Close() data, err := ioutil.ReadAll(c.Request.Body) if err != nil { logrus.Errorf("读取数据失败:%e\n", err) return } host, err := GetHost(c) if err != nil { logrus.Errorf("获取host失败:%e\n", err) return } isapi.TouChuan(host, isapi.PutLineDetection, data, c) }