]> git.ipfire.org Git - location/libloc.git/blob - man/location-query.txt
downloader: Change user-agent to location
[location/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 update`
12 `location-query verify`
13 `location-query list-networks-by-as ASN`
14 `location-query list-networks-by-cc COUNTRY_CODE`
15 `location-query list-networks-by-flags [--anonymous-proxy|--satellite-provider|--anycast]`
16
17 == DESCRIPTION
18 The `location-query` retrieves information from the location database.
19 This data can be used to determine someone's location on the Internet
20 and for building firewall rulesets to block access from certain ASes
21 or countries.
22
23 == OPTIONS
24
25 --database FILE::
26 -d FILE::
27 The path of the database which is being opened.
28 +
29 If this option is omitted, the system's database will be opened.
30
31 --quiet::
32 Enable quiet mode
33
34 --debug::
35 Enable debugging mode
36
37 == COMMANDS
38
39 'lookup ADDRESS [ADDRESS...]'::
40 This command returns the network the given IP address has been found in
41 as well as its Autonomous System if that information is available.
42
43 'get-as ASN [ASN...]'::
44 This command returns the name of the owning organisation of the Autonomous
45 System.
46
47 'search-as STRING'::
48 Lists all Autonomous Systems which match the given string.
49 +
50 The search will be performed case-insensitively.
51
52 'update'::
53 This command will try to update the local database.
54 +
55 It will terminate with a return code of zero if the database has been
56 successfully updated. 1 on error, 2 on invalid call and 3 if the
57 database was already the latest version.
58
59 'verify'::
60 Verifies the downloaded database.
61
62 'list-networks-by-as [--family=[ipv6|ipv4]] [--output-format FORMAT] ASN'::
63 Lists all networks which belong to this Autonomous System.
64 +
65 The '--family' parameter can be used to filter output to only IPv6 or
66 IPv4 addresses.
67 +
68 The '--output-format' parameter can change the output so that it can be
69 directly loaded into other software. The following options are available:
70 +
71 * 'list' (default): Just lists all networks, one per line
72 * 'ipset': For ipset
73 * 'nftables': For nftables
74 * 'xt_geoip': Returns a list of networks to be loaded into the xt_geoip
75 kernel module
76
77 'list-networks-by-cc [--family=[ipv6|ipv4]] [--output-format FORMAT] COUNTRY_CODE'::
78 Lists all networks that belong to a country.
79 +
80 The country has to be encoded in ISO3166 Alpha-2 notation.
81 +
82 See above for usage of the '--family' and '--output-format' parameters.
83
84 'list-networks-by-flags [--family=[ipv6|ipv4]] [--output-format FORMAT] [--anonymous-proxy|--satellite-provider|--anycast]'::
85 Lists all networks that have a certain flag.
86 +
87 See above for usage of the '--family' and '--output-format' parameters.
88
89 '--help'::
90 Shows a short help text on using this program.
91
92 '--version'::
93 Shows the program's version and exists.
94
95 == EXIT CODES
96 The 'location-query' command will normally exit with code zero.
97 If there has been a problem and the requested action could not be performed,
98 the exit code is unequal to zero.
99
100 == HOW IT WORKS
101 The downloader checks a DNS record for the latest version of the database.
102 It will then try to download a file with that version from a mirror server.
103 If the downloaded file is outdated, the next mirror will be tried until we
104 have found a file that is recent enough.
105
106 == BUGS
107 Please report all bugs to the bugtracker at https://bugzilla.ipfire.org/.
108
109 == AUTHORS
110 Michael Tremer