]> git.ipfire.org Git - location/libloc.git/blame - man/location.txt
Add option to iterate over all countries and print them to the console
[location/libloc.git] / man / location.txt
CommitLineData
1d237439 1= location(8)
161ac92d
MT
2
3== NAME
1d237439 4location - Query the location database
161ac92d
MT
5
6== SYNOPSIS
7[verse]
1d237439
MT
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]`
fa9a3663 16`location list-countries [--show-name] [--show-continent]`
161ac92d
MT
17
18== DESCRIPTION
1d237439 19`location` retrieves information from the location database.
161ac92d
MT
20This data can be used to determine someone's location on the Internet
21and for building firewall rulesets to block access from certain ASes
22or 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
e16d1683
MT
32--quiet::
33 Enable quiet mode
34
161ac92d
MT
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
889b932a
MT
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
44e5ef71 63'list-networks-by-as [--family=[ipv6|ipv4]] [--output-format FORMAT] ASN'::
161ac92d 64 Lists all networks which belong to this Autonomous System.
4439e317 65 +
44e5ef71
MT
66 The '--family' parameter can be used to filter output to only IPv6 or
67 IPv4 addresses.
68 +
4439e317
MT
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
6da14cc1 73 * 'ipset': For ipset
71e0ad0b 74 * 'nftables': For nftables
4439e317
MT
75 * 'xt_geoip': Returns a list of networks to be loaded into the xt_geoip
76 kernel module
161ac92d 77
44e5ef71 78'list-networks-by-cc [--family=[ipv6|ipv4]] [--output-format FORMAT] COUNTRY_CODE'::
161ac92d
MT
79 Lists all networks that belong to a country.
80 +
81 The country has to be encoded in ISO3166 Alpha-2 notation.
4439e317 82 +
44e5ef71 83 See above for usage of the '--family' and '--output-format' parameters.
161ac92d 84
44e5ef71 85'list-networks-by-flags [--family=[ipv6|ipv4]] [--output-format FORMAT] [--anonymous-proxy|--satellite-provider|--anycast]'::
bbdb2e0a
MT
86 Lists all networks that have a certain flag.
87 +
44e5ef71 88 See above for usage of the '--family' and '--output-format' parameters.
bbdb2e0a 89
fa9a3663
MT
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
161ac92d
MT
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
1d237439 103The 'location' command will normally exit with code zero.
161ac92d
MT
104If there has been a problem and the requested action could not be performed,
105the exit code is unequal to zero.
106
889b932a
MT
107== HOW IT WORKS
108The downloader checks a DNS record for the latest version of the database.
109It will then try to download a file with that version from a mirror server.
110If the downloaded file is outdated, the next mirror will be tried until we
111have found a file that is recent enough.
112
161ac92d
MT
113== BUGS
114Please report all bugs to the bugtracker at https://bugzilla.ipfire.org/.
115
116== AUTHORS
117Michael Tremer