mirror of https://git.keinpfusch.net/loweel/zabov
- added new setting: default/global timetable ( config->zabov->timetable )
This table will be used for any client that is not already included in an IP group
This commit is contained in:
parent
85ff0dac52
commit
d2f8601185
|
@ -216,6 +216,15 @@ func init() {
|
||||||
ZabovIPGroups = append(ZabovIPGroups, groupStruct)
|
ZabovIPGroups = append(ZabovIPGroups, groupStruct)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if zabov["timetable"] != nil {
|
||||||
|
ZabovDefaultTimetable = zabov["timetable"].(string)
|
||||||
|
_, ok := ZabovTimetables[ZabovDefaultTimetable]
|
||||||
|
if !ok {
|
||||||
|
log.Println("inexistent timetable:", ZabovDefaultTimetable)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
localresponder := MyConf["localresponder"].(map[string]interface{})
|
localresponder := MyConf["localresponder"].(map[string]interface{})
|
||||||
|
|
||||||
if localresponder != nil {
|
if localresponder != nil {
|
||||||
|
|
13
README.md
13
README.md
|
@ -94,7 +94,9 @@ Advanced configuration includes support for multiple configurations based on IP
|
||||||
"proto":"udp",
|
"proto":"udp",
|
||||||
"ipaddr":"0.0.0.0",
|
"ipaddr":"0.0.0.0",
|
||||||
"cachettl": 1,
|
"cachettl": 1,
|
||||||
"killfilettl": 12
|
"killfilettl": 12,
|
||||||
|
"debug":"false",
|
||||||
|
"timetable":"tt_default"
|
||||||
},
|
},
|
||||||
"localresponder":{
|
"localresponder":{
|
||||||
"responder":"192.168.178.1:53",
|
"responder":"192.168.178.1:53",
|
||||||
|
@ -117,6 +119,11 @@ Advanced configuration includes support for multiple configurations based on IP
|
||||||
"cfgin":"children_restricted",
|
"cfgin":"children_restricted",
|
||||||
"cfgout":"default"
|
"cfgout":"default"
|
||||||
}
|
}
|
||||||
|
"tt_default":{
|
||||||
|
"tables":[{"times":"8:30-22:30", "days":"Su"}],
|
||||||
|
"cfgin":"children",
|
||||||
|
"cfgout":"default"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"configs":{
|
"configs":{
|
||||||
"default":{
|
"default":{
|
||||||
|
@ -144,6 +151,10 @@ Advanced configuration includes support for multiple configurations based on IP
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
Global zabov settings:
|
||||||
|
|
||||||
|
- timetable: sets the global/default timetable. This table will be used for any client that is not already included in an IP group
|
||||||
|
|
||||||
localresponder:
|
localresponder:
|
||||||
- allows to set a local DNS to respond for "local" domains. A domain name is handled as "local" if dosen't contains "." (dots) or if it ends with a well known prefix, such as ".local".
|
- allows to set a local DNS to respond for "local" domains. A domain name is handled as "local" if dosen't contains "." (dots) or if it ends with a well known prefix, such as ".local".
|
||||||
Note: the cache is not used for local responder.
|
Note: the cache is not used for local responder.
|
||||||
|
|
|
@ -178,7 +178,6 @@ func confFromTimeTable(timetable string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func confFromIP(clientIP net.IP) (string, string) {
|
func confFromIP(clientIP net.IP) (string, string) {
|
||||||
|
|
||||||
for _, ipgroup := range ZabovIPGroups {
|
for _, ipgroup := range ZabovIPGroups {
|
||||||
for _, ip := range ipgroup.ips {
|
for _, ip := range ipgroup.ips {
|
||||||
if clientIP.Equal(ip) {
|
if clientIP.Equal(ip) {
|
||||||
|
@ -186,12 +185,16 @@ func confFromIP(clientIP net.IP) (string, string) {
|
||||||
return confFromTimeTable(ipgroup.timetable), ipgroup.timetable
|
return confFromTimeTable(ipgroup.timetable), ipgroup.timetable
|
||||||
}
|
}
|
||||||
if ZabovDebug {
|
if ZabovDebug {
|
||||||
log.Println("confFromIP: ipgroup.cfg")
|
log.Println("confFromIP: ipgroup.cfg", ipgroup.cfg)
|
||||||
}
|
}
|
||||||
return ipgroup.cfg, ""
|
return ipgroup.cfg, ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(ZabovDefaultTimetable) > 0 {
|
||||||
|
return confFromTimeTable(ZabovDefaultTimetable), ZabovDefaultTimetable
|
||||||
|
}
|
||||||
|
|
||||||
if ZabovDebug {
|
if ZabovDebug {
|
||||||
log.Println("confFromIP: return default")
|
log.Println("confFromIP: return default")
|
||||||
}
|
}
|
||||||
|
|
3
main.go
3
main.go
|
@ -22,6 +22,9 @@ var ZabovLocalResponder string
|
||||||
//ZabovLocalDomain is the default local domain (global)
|
//ZabovLocalDomain is the default local domain (global)
|
||||||
var ZabovLocalDomain string
|
var ZabovLocalDomain string
|
||||||
|
|
||||||
|
//ZabovDefaultTimetable is the default timetable, applied to any client that is not already in any IP Group (global)
|
||||||
|
var ZabovDefaultTimetable string
|
||||||
|
|
||||||
//ZabovDebug activate more logging if set to true (global)
|
//ZabovDebug activate more logging if set to true (global)
|
||||||
var ZabovDebug bool
|
var ZabovDebug bool
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue