25 lines
403 B
Go
25 lines
403 B
Go
package service
|
|
|
|
import "context"
|
|
|
|
type (
|
|
ITrafficCutoff interface {
|
|
Check(ctx context.Context)
|
|
}
|
|
)
|
|
|
|
var (
|
|
localTrafficCutoff ITrafficCutoff
|
|
)
|
|
|
|
func TrafficCutoff() ITrafficCutoff {
|
|
if localTrafficCutoff == nil {
|
|
panic("implement not found for interface ITrafficCutoff, forgot register?")
|
|
}
|
|
return localTrafficCutoff
|
|
}
|
|
|
|
func RegisterTrafficCutoff(i ITrafficCutoff) {
|
|
localTrafficCutoff = i
|
|
}
|