probe/auth/service/NoAuthProbeService.go
crusader 45dc0f9920 ing
2018-04-13 20:59:46 +09:00

33 lines
756 B
Go

package service
import (
"reflect"
cda "git.loafle.net/commons/di-go/annotation"
cdr "git.loafle.net/commons/di-go/registry"
_ "git.loafle.net/overflow/commons-go/core/annotation"
)
var NoAuthProbeServiceType = reflect.TypeOf((*NoAuthProbeService)(nil))
func init() {
cdr.RegisterType(NoAuthProbeServiceType)
}
type NoAuthProbeService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
AcceptedChan chan<- string `annotation:"@Resource(name='AcceptedChan')"`
DeniedChan chan<- struct{} `annotation:"@Resource(name='DeniedChan')"`
}
func (s *NoAuthProbeService) Accept(probeKey string) error {
s.AcceptedChan <- probeKey
return nil
}
func (s *NoAuthProbeService) Deny() error {
s.DeniedChan <- struct{}{}
return nil
}