]> git.ipfire.org Git - people/ms/libloc.git/blob - man/location-query.txt
957dc01c5ff53c970f303bc30ed3fa676f8ec283
[people/ms/libloc.git] / man / location-query.txt
1 = location-query(8)
2
3 == NAME
4 location-query - Query the location database
5
6 == SYNOPSIS
7 [verse]
8 `location-query lookup ADDRESS [ADDRESS...]`
9 `location-query get-as ASN [ASN...]`
10 `location-query search-as STRING`
11 `location-query list-networks-by-as ASN`
12 `location-query list-networks-by-cc COUNTRY_CODE`
13 `location-query list-networks-by-flags [--anonymous-proxy|--satellite-provider|--anycast]`
14
15 == DESCRIPTION
16 The `location-query` retrieves information from the location database.
17 This data can be used to determine someone's location on the Internet
18 and for building firewall rulesets to block access from certain ASes
19 or countries.
20
21 == OPTIONS
22
23 --database FILE::
24 -d FILE::
25 The path of the database which is being opened.
26 +
27 If this option is omitted, the system's database will be opened.
28
29 --debug::
30 Enable debugging mode
31
32 == COMMANDS
33
34 'lookup ADDRESS [ADDRESS...]'::
35 This command returns the network the given IP address has been found in
36 as well as its Autonomous System if that information is available.
37
38 'get-as ASN [ASN...]'::
39 This command returns the name of the owning organisation of the Autonomous
40 System.
41
42 'search-as STRING'::
43 Lists all Autonomous Systems which match the given string.
44 +
45 The search will be performed case-insensitively.
46
47 'list-networks-by-as [--output-format FORMAT] ASN'::
48 Lists all networks which belong to this Autonomous System.
49 +
50 The '--output-format' parameter can change the output so that it can be
51 directly loaded into other software. The following options are available:
52 +
53 * 'list' (default): Just lists all networks, one per line
54 * 'ipset': For ipset
55 * 'nftables': For nftables
56 * 'xt_geoip': Returns a list of networks to be loaded into the xt_geoip
57 kernel module
58
59 'list-networks-by-cc [--output-format FORMAT] COUNTRY_CODE'::
60 Lists all networks that belong to a country.
61 +
62 The country has to be encoded in ISO3166 Alpha-2 notation.
63 +
64 See above for usage of the '--output-format' parameter.
65
66 'list-networks-by-flags [--output-format FORMAT] [--anonymous-proxy|--satellite-provider|--anycast]'::
67 Lists all networks that have a certain flag.
68 +
69 See above for usage of the '--output-format' parameter.
70
71 '--help'::
72 Shows a short help text on using this program.
73
74 '--version'::
75 Shows the program's version and exists.
76
77 == EXIT CODES
78 The 'location-query' command will normally exit with code zero.
79 If there has been a problem and the requested action could not be performed,
80 the exit code is unequal to zero.
81
82 == BUGS
83 Please report all bugs to the bugtracker at https://bugzilla.ipfire.org/.
84
85 == AUTHORS
86 Michael Tremer