24 lines
389 B
Go
24 lines
389 B
Go
package common
|
|
|
|
import (
|
|
"net"
|
|
"reflect"
|
|
"strings"
|
|
)
|
|
|
|
var (
|
|
Sources map[string]SourceModuleType //Available source modules storage
|
|
)
|
|
|
|
type SourceModuleType interface {
|
|
Get(url string) ([]net.IPNet, error)
|
|
}
|
|
|
|
func init() {
|
|
Sources = make(map[string]SourceModuleType)
|
|
}
|
|
|
|
func RegisterSource(src SourceModuleType) {
|
|
Sources[strings.ToLower(reflect.ValueOf(src).Type().Name())] = src
|
|
}
|