probe/service/MachineService.go
crusader 57cb5cf1a9 ing
2018-09-14 01:14:34 +09:00

41 lines
843 B
Go

package service
import (
"log"
"reflect"
oa "git.loafle.net/overflow/annotation-go"
od "git.loafle.net/overflow/di-go"
omn "git.loafle.net/overflow/model/net"
"git.loafle.net/overflow_scanner/probe/nic"
)
func init() {
od.RegisterType(MachineServiceType)
}
var MachineServiceType = reflect.TypeOf((*MachineService)(nil))
type MachineService struct {
oa.TypeAnnotation `annotation:"@Injectable('name': 'MachineService') @Service()"`
_InitService oa.MethodAnnotation `annotation:"@PostConstruct()"`
_DestroyService oa.MethodAnnotation `annotation:"@PreDestroy()"`
}
func (s *MachineService) InitService() {
}
func (s *MachineService) DestroyService() {
}
func (s *MachineService) Interfaces() ([]*omn.Interface, error) {
ifaces, err := nic.DiscoverInterfaces()
if nil != err {
log.Print(err)
}
return ifaces, err
}