Added more logging to the plugin
This commit is contained in:
parent
591065aa3a
commit
0e065a2e61
|
@ -97,6 +97,7 @@ func setupPlugin(c *caddy.Controller) (*plug, error) {
|
||||||
blockValue := c.Val()
|
blockValue := c.Val()
|
||||||
switch blockValue {
|
switch blockValue {
|
||||||
case "safebrowsing":
|
case "safebrowsing":
|
||||||
|
log.Println("Browsing security service is enabled")
|
||||||
p.d.EnableSafeBrowsing()
|
p.d.EnableSafeBrowsing()
|
||||||
if c.NextArg() {
|
if c.NextArg() {
|
||||||
if len(c.Val()) == 0 {
|
if len(c.Val()) == 0 {
|
||||||
|
@ -105,6 +106,7 @@ func setupPlugin(c *caddy.Controller) (*plug, error) {
|
||||||
p.d.SetSafeBrowsingServer(c.Val())
|
p.d.SetSafeBrowsingServer(c.Val())
|
||||||
}
|
}
|
||||||
case "safesearch":
|
case "safesearch":
|
||||||
|
log.Println("Safe search is enabled")
|
||||||
p.d.EnableSafeSearch()
|
p.d.EnableSafeSearch()
|
||||||
case "parental":
|
case "parental":
|
||||||
if !c.NextArg() {
|
if !c.NextArg() {
|
||||||
|
@ -114,6 +116,8 @@ func setupPlugin(c *caddy.Controller) (*plug, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, c.ArgErr()
|
return nil, c.ArgErr()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Println("Parental control is enabled")
|
||||||
err = p.d.EnableParental(sensitivity)
|
err = p.d.EnableParental(sensitivity)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, c.ArgErr()
|
return nil, c.ArgErr()
|
||||||
|
@ -128,14 +132,15 @@ func setupPlugin(c *caddy.Controller) (*plug, error) {
|
||||||
if !c.NextArg() {
|
if !c.NextArg() {
|
||||||
return nil, c.ArgErr()
|
return nil, c.ArgErr()
|
||||||
}
|
}
|
||||||
blockttl, err := strconv.ParseUint(c.Val(), 10, 32)
|
blockedTtl, err := strconv.ParseUint(c.Val(), 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, c.ArgErr()
|
return nil, c.ArgErr()
|
||||||
}
|
}
|
||||||
p.settings.BlockedTTL = uint32(blockttl)
|
log.Printf("Blocked request TTL is %d", blockedTtl)
|
||||||
|
p.settings.BlockedTTL = uint32(blockedTtl)
|
||||||
case "querylog":
|
case "querylog":
|
||||||
|
log.Println("Query log is enabled")
|
||||||
p.settings.QueryLogEnabled = true
|
p.settings.QueryLogEnabled = true
|
||||||
|
|
||||||
case "filter":
|
case "filter":
|
||||||
if !c.NextArg() {
|
if !c.NextArg() {
|
||||||
return nil, c.ArgErr()
|
return nil, c.ArgErr()
|
||||||
|
|
Loading…
Reference in New Issue