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