policy

package module
v0.0.0-...-89deedc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

README

policy

Name

policy - advanced DNS traffic management based on domain name policies.

Description

policy The policy plugin offers domain-based policy rules, it works like view plugin. It supports rule files in the Adblock Plus (ADB) format. You can combine with acl to do filter, or combine with forward to do forward.

Syntax

policy RULE_FILE {
    base64
    period PERIOD
    cache_dir CACHE_DIR
}
  • RULE_FILE: The path to the rule file. Could be a local file or a remote file ( http://example.local/rule.txt ).

  • base64: If set, the rule file is base64 encoded.

  • PERIOD: The period of time to reload the rule file. Useful for remote file. Unit: go format ("60m", "72h").

  • CACHE_DIR: If set ,will download remote file at this place. Also use this file on start up.

Examples

.:53 {
    errors
    ready

    policy /path/banner_list.txt
    
    acl . {
       block
    }
}

.:53 {
    errors
    ready

    policy /path/internal-domains.txt
    
    forward . tls://some-internal-upstream
}

.:53 {
    errors
    ready

    forward . tls://default-upstream
}

notes

You can not use policy and view in the same block.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Engine) Match

func (e *Engine) Match(r *dns.Msg) bool

func (*Engine) Run

func (e *Engine) Run()

type EngineInterface

type EngineInterface interface {
	Match(r *dns.Msg) bool
	Run()
}

type Policy

type Policy struct {
	Next plugin.Handler
	// contains filtered or unexported fields
}

Policy is a plugin that returns a HINFO reply to ANY queries.

func (*Policy) Filter

func (a *Policy) Filter(ctx context.Context, req *request.Request) bool

func (*Policy) Name

func (a *Policy) Name() string

Name implements the Handler interface.

func (*Policy) OnShutdown

func (a *Policy) OnShutdown() error

func (*Policy) OnStartup

func (a *Policy) OnStartup() error

func (*Policy) ServeDNS

func (a *Policy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface.

func (*Policy) ViewName

func (a *Policy) ViewName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL