Search
Varnish Enterprise

asn

Description

This Varnish module exports functions to look up Autonomous System Numbers (ASN) from https://iptoasn.com/ tsv database.

Example

vcl 4.1;
import asn;

backend be none;

sub vcl_init {
	new objasn = asn.init("ip2asn-combined.tsv");
}

sub vcl_recv {
	set req.http.asn = objasn.asn(client.ip);
	set req.http.company = objasn.asn(
	    std.ip(req.http.X-forwarded-for, "0.0.0.0"));
}

init

OBJECT init(STRING)

Create an ASN object and load a TSV file.

Arguments: None

Type: Object

Returns: Object.

.asn

STRING .asn(IP)

Lookup ASN from IP

Arguments: None

Type: Method

Returns: String

.company

STRING .company(IP)

Lookup company from IP

Arguments: None

Type: Method

Returns: String

.country

STRING .country(IP)

Lookup country of ASN from IP

SEE ALSO

vcl(7), varnishd(1)

Arguments: None

Type: Method

Returns: String


®Varnish Software, Wallingatan 12, 111 60 Stockholm, Organization nr. 556805-6203