package bus import ( "reflect" "github.com/gin-gonic/gin" "github.com/yuguorong/go/log" ) type RestAppInfo struct { AppID string AppSecret string } type RestApi struct { baseBus router *gin.Engine port int mapApp map[string]*RestAppInfo } func (rest *RestApi) Init() error { log.Info("REST module init.") rest.router = gin.Default() //router.GET("/Gateway4G/UpdateDevcie", hello) // hello函数处理"/hello"请求 // 指定地址和端口号 go rest.router.Run(":10001") return nil } func (rest *RestApi) Uninit() { } func (rest *RestApi) MountChannel(chnID interface{}, router []chan interface{}) IChannel { if reflect.TypeOf(chnID).Kind() != reflect.String { log.Error("wrong channel type, REST URL need a string!") return nil } url := chnID.(string) log.Info("Rest channel:", url) return nil } func (rest *RestApi) FreeChannel(chn IChannel) error { return nil } func (rest *RestApi) ResetChannel(chn IChannel) { } func (rest *RestApi) ScanChannel(stream []byte, conn int) IChannel { return nil } func (rest *RestApi) Send(chn IChannel, buff interface{}) (int, error) { return 0, nil } func (rest *RestApi) Recive(chn IChannel, buff interface{}) (int, error) { return 0, nil }