drblpeer

package module
v0.0.0-...-b815c2d Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: BSD-3-Clause Imports: 12 Imported by: 1

README

drbl-peer

GoLang library for testing domains and ip addresses against a set of dns or dnsrbl or httpbl service.

Example for squid external_acl_type usage configurations

external_acl_type dnsbl_check ipv4 concurrency=200 ttl=15 %DST %SRC %METHOD /opt/bin/squid-external-acl-helper -peers-filename=/opt/bin/peersfile.txt
acl dnsbl_check_acl external dnsbl_check
deny_info http://ngtech.co.il/block_page/?url=%u&domain=%H dnsbl_check_acl

http_access deny dnsbl_check_acl

License

Copyright (c) 2016, Eliezer Croitoru All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DRBLClientUA = "DRBL-Peer Client V1"

DRBLClientUA ---

Functions

func ReverseTheDomain

func ReverseTheDomain(orig string) string

Types

type DrblClient

type DrblClient struct {
	Peername    string
	Path        string
	Port        int
	Weight      int64
	Protocol    string
	BlResponses []string
	Resolver    *dns_resolver.DnsResolver
	Client      *http.Client
}

DrblClient ---

func New

func New(peerName, protocol, path string, port int, weight int64, bladdr []string) *DrblClient

func NewPeerFromLine

func NewPeerFromLine(peerline string) (*DrblClient, error)

func NewPeerFromYaml

func NewPeerFromYaml(peer YamlPeerDrblName) (*DrblClient, error)

func (*DrblClient) Check

func (instance *DrblClient) Check(hostname string, debug bool) (bool, bool, bool, string, error)

return: found, allow\deny, admin\nonadmin, error)

func (*DrblClient) HttpCheckUrlWithSrc

func (instance *DrblClient) HttpCheckUrlWithSrc(requestUrl, src string, debug bool) (bool, bool, bool, string, error)

type DrblPeers

type DrblPeers struct {
	Peers     []DrblClient
	HitWeight int64
	Timeout   int
	Debug     bool
}

func NewPeerListFromFile

func NewPeerListFromFile(filename string, hitWeight int64, timeout int, debug bool) (*DrblPeers, error)

func NewPeerListFromYamlFile

func NewPeerListFromYamlFile(filename string, hitWeight int64, timeout int, debug bool) (*DrblPeers, error)

func (*DrblPeers) Check

func (peersList *DrblPeers) Check(hostname string) (bool, int64)

Block and weight

func (*DrblPeers) CheckUrlWithSrc

func (peersList *DrblPeers) CheckUrlWithSrc(requestUrl, src string) (bool, int64)

type YamlDrblPeers

type YamlDrblPeers struct {
	Clients []YamlPeerDrblName `peers`
}

type YamlPeerDrblName

type YamlPeerDrblName struct {
	Peer     string   `name`
	Type     string   `type`
	Host     string   `host`
	Port     int      `port`
	Weight   int      `weight`
	Path     string   `path`
	Expected []string `expected`
}

Directories

Path Synopsis
examples-icap
icap-hostname-logger
An example of how to use go-icap.
An example of how to use go-icap.

Jump to

Keyboard shortcuts

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