Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libloc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
libloc
Commits
d6d06375
Commit
d6d06375
authored
May 15, 2020
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
location-query: Include flags in dump output
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
ee83fe2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
src/python/location-query.in
src/python/location-query.in
+19
-5
No files found.
src/python/location-query.in
View file @
d6d06375
...
...
@@ -312,6 +312,9 @@ class CLI(object):
# Use output file or write to stdout
f
=
ns
.
output
or
sys
.
stdout
# Format everything like this
format
=
"%-24s %s
\
n
"
# Write metadata
f
.
write
(
"#
\
n
# Location Database Export
\
n
#
\
n
"
)
...
...
@@ -336,19 +339,30 @@ class CLI(object):
# Iterate over all ASes
for
a
in
db
.
ases
:
f
.
write
(
"
\
n
"
)
f
.
write
(
"aut-num: AS%s
\
n
"
%
a
.
number
)
f
.
write
(
"name: %s
\
n
"
%
a
.
name
)
f
.
write
(
format
%
(
"aut-num:"
,
"AS%s"
%
a
.
number
))
f
.
write
(
format
%
(
"name:"
,
a
.
name
))
flags
=
{
location
.
NETWORK_FLAG_ANONYMOUS_PROXY
:
"is-anonymous-proxy:"
,
location
.
NETWORK_FLAG_SATELLITE_PROVIDER
:
"is-satellite-provider:"
,
location
.
NETWORK_FLAG_ANYCAST
:
"is-anycast:"
,
}
# Iterate over all networks
for
n
in
db
.
networks
:
f
.
write
(
"
\
n
"
)
f
.
write
(
"net: %s
\
n
"
%
n
)
f
.
write
(
format
%
(
"net:"
,
n
)
)
if
n
.
country_code
:
f
.
write
(
"country: %s
\
n
"
%
n
.
country_code
)
f
.
write
(
format
%
(
"country:"
,
n
.
country_code
)
)
if
n
.
asn
:
f
.
write
(
"autnum: %s
\
n
"
%
n
.
asn
)
f
.
write
(
format
%
(
"autnum:"
,
n
.
asn
))
# Print all flags
for
flag
in
flags
:
if
n
.
has_flag
(
flag
):
f
.
write
(
format
%
(
flags
[
flag
],
"yes"
))
def
handle_get_as
(
self
,
db
,
ns
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment