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