-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
providers.go
30 lines (26 loc) · 980 Bytes
/
providers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package main
import "io"
// Provider invocation function
// args:
// index int: a number that won't collide with other [[match]] blocks, can be used for naming
// c map[string]interface{}: the user-supplied config
// o io.Writer: a binary buffer you should put your part of config to
type MatchListProvider func(int, map[string]interface{}, io.Writer)
// define a list of provider functions
var providers = map[string]MatchListProvider{
"DomainList": DomainList,
"ActiveDirectory": ActiveDirectory,
// "gfwlist": GfwList,
"dnsmasq-china-list": DnsmasqChinaList,
// "DomainListUrl": DomainListUrl,
}
// provide a convenient helper to generate the same set of config for a provider that:
// * only generate a single pool
// it currently does:
// * assign an packet cache
func generateDefaultProviderTasks(poolName string, c map[string]interface{}, o io.Writer) {
// cache
if conf.Cache.Enabled {
assignCache(poolName, globalPacketCache, o)
}
}