templates_locationdir = $(templatesdir)/location
templates_location_how_to_use_DATA = \
- src/templates/location/how-to-use/index.html
+ src/templates/location/how-to-use/cli.html \
+ src/templates/location/how-to-use/index.html \
+ src/templates/location/how-to-use/python.html
templates_location_how_to_usedir = $(templates_locationdir)/how-to-use
--- /dev/null
+{% extends "../../base.html" %}
+
+{% block title %}{{ _("How To Use?") }} - {{ _("Command Line") }}{% end block %}
+
+{% block container %}
+ <section class="hero is-light">
+ <div class="hero-body">
+ <div class="container">
+ <nav class="breadcrumb" aria-label="breadcrumbs">
+ <ul>
+ <li>
+ <a href="/">
+ {{ _("Home") }}
+ </a>
+ </li>
+ <li>
+ <a href="/location">
+ {{ _("Location") }}
+ </a>
+ </li>
+ <li>
+ <a href="/location/how-to-use">
+ {{ _("How To Use?") }}
+ </a>
+ </li>
+ <li class="is-active">
+ <a href="#" aria-current="page">{{ _("Command Line") }}</a>
+ </li>
+ </ul>
+ </nav>
+
+ <h1 class="title">{{ _("Command Line") }}</h1>
+ </div>
+ </div>
+ </section>
+
+ <section class="section">
+ <div class="container">
+ <div class="columns">
+ <div class="column">
+ <div class="content">
+ <p>
+ <code>libloc</code> comes with a command line tool which
+ makes it easy to test the library or integrate it into
+ your shell scripts.
+ <code>location(8)</code> knows a couple of commands
+ to retrieve country or Autonomous System of an IP address
+ and can generate lists of networks to be imported into
+ other software.
+ </p>
+
+ <p>
+ Although this is not the fastest way to lookup a large number
+ of IP addresses, <code>location(8)</code> is versatile
+ and very easy to use.
+ </p>
+
+ <a class="button is-light" href="https://man-pages.ipfire.org/libloc/location.html">
+ {{ _("Man Page") }}
+ </a>
+ </div>
+ </div>
+
+ <div class="column is-narrow">
+ <figure class="image is-256x256">
+ <img src="{{ static_url("img/bash-logo.svg") }}" alt="{{ _("CLI") }}">
+ </figure>
+ </div>
+ </div>
+
+ <div class="block">
+ <h6 class="title is-6">{{ _("Search for an Autonomous System by Name") }}</h6>
+
+ <pre><code>$ location search-as "Lightning Wire Labs"
+AS204867 (Lightning Wire Labs GmbH)</code></pre>
+ </div>
+
+ <div class="block">
+ <h6 class="title is-6">{{ _("Lookup an IP Address") }}</h6>
+
+ <pre><code>$ location lookup 81.3.27.38
+81.3.27.38 belongs to 81.3.27.0/24 which is a part of AS24679 (Hostway Deutschland GmbH)</code></pre>
+ </div>
+ </div>
+ </section>
+{% end block %}
{% block title %}{{ _("How To Use?") }}{% end block %}
{% block container %}
- <section class="hero is-primary">
+ <section class="hero is-light">
<div class="hero-body">
<div class="container">
<nav class="breadcrumb" aria-label="breadcrumbs">
</a>
</li>
<li class="is-active">
- <a href="#" aria-current="page">{{ _("How to use?") }}</a>
+ <a href="#" aria-current="page">{{ _("How To Use?") }}</a>
</li>
</ul>
</nav>
- <h1 class="title">{{ _("IPFire Location") }}</h1>
- <h6 class="subtitle">
- <code>libloc</code> is versatile, fast and easy to use
- in any application.
- </h6>
+ <h1 class="title">{{ _("How To Use?") }}</h1>
</div>
</div>
</section>
<section class="section">
<div class="container">
- <div class="columns">
- <div class="column">
- <h2 class="title is-2">{{ _("Command Line") }}</h2>
+ <p>
+ The heart of the IPFire Location project is a small, lightweight library
+ called <code>libloc</code>.
- <div class="content">
- <p>
- <code>libloc</code> comes with a command line tool which
- makes it easy to test the library or integrate it into
- your shell scripts.
- <code>location(8)</code> knows a couple of commands
- to retrieve country or Autonomous System of an IP address
- and can generate lists of networks to be imported into
- other software.
- </p>
-
- <p>
- Although this is not the fastest way to lookup a large number
- of IP addresses, <code>location(8)</code> is versatile
- and very easy to use.
- </p>
-
- <a class="button is-light" href="https://man-pages.ipfire.org/libloc/location.html">
- {{ _("Man Page") }}
- </a>
- </div>
- </div>
-
- <div class="column is-narrow">
- <figure class="image is-256x256">
- <img src="{{ static_url("img/bash-logo.svg") }}" alt="{{ _("CLI") }}">
- </figure>
- </div>
- </div>
-
- <div class="block">
- <h6 class="title is-6">{{ _("Search for an Autonomous System by Name") }}</h6>
-
- <pre><code>$ location search-as "Lightning Wire Labs"
-AS204867 (Lightning Wire Labs GmbH)</code></pre>
- </div>
-
- <div class="block">
- <h6 class="title is-6">{{ _("Lookup an IP Address") }}</h6>
-
- <pre><code>$ location lookup 81.3.27.38
-81.3.27.38 belongs to 81.3.27.0/24 which is a part of AS24679 (Hostway Deutschland GmbH)</code></pre>
- </div>
+ It sources the data, builds and reads the database.
+ </p>
</div>
</section>
<section class="section">
<div class="container">
- <div class="columns">
- <div class="column is-narrow">
- <figure class="image is-256x256">
- <img src="{{ static_url("img/python-logo.svg") }}"
- alt="{{ _("Python") }}">
- </figure>
- </div>
-
- <div class="column">
- <h2 class="title is-2">{{ _("Python") }}</h2>
-
- <div class="content">
- <p>
- <code>libloc</code> comes with native Python bindings which
- are used by its main command-line tool
- <a class="text-white" href="https://man-pages.ipfire.org/libloc/location.html">
- <code>location</code>
- </a>.
- They are the most advanced bindings as they support reading
- from the database as well as writing to it.
- </p>
- </div>
- </div>
- </div>
-
- <div class="block">
- <h6 class="title is-6">{{ _("Load the database") }}</h6>
-
- <pre><code>Python 3.7.3 (default, Apr 3 2019, 05:39:12)
-[GCC 8.3.0] on linux
-Type "help", "copyright", "credits" or "license" for more information.
->>> import location
->>> d = location.Database("/usr/share/location/database.db")</code></pre>
- </div>
-
- <div class="block">
- <h6 class="title is-6">{{ _("Search for an Autonomous System by Name") }}</h6>
-
- <pre><code>>>> for i in d.search_as("Lightning Wire Labs"):
-... print(i)
-...
-AS204867 (Lightning Wire Labs GmbH)</code></pre>
- </div>
-
- <div class="block">
- <h6 class="title is-6">{{ _("Lookup an IP Address") }}</h6>
-
- <pre><code>>>> n = d.lookup("81.3.27.38")
->>> n
-<location.Network 81.3.27.0/24>
->>> n.asn
-24679
->>> n.country_code
-'DE'</code></pre>
+ <div class="buttons are-medium">
+ <a class="button is-light is-fullwidth" href="/location/how-to-use/cli">
+ <span class="icon">
+ <i class="fa-solid fa-terminal"></i>
+ </span>
+ <span>{{ _("Command Line") }}</span>
+ </a>
+
+ <a class="button is-light is-fullwidth" href="/location/how-to-use/c" disabled>
+ {{ _("C/C++") }}
+ </a>
+
+ <a class="button is-light is-fullwidth" href="/location/how-to-use/python">
+ <span class="icon">
+ <i class="fa-brands fa-python"></i>
+ </span>
+ <span>{{ _("Python") }}</span>
+ </a>
+
+ <a class="button is-light is-fullwidth" href="/location/how-to-use/lua" disabled>
+ {{ _("Lua") }}
+ </a>
+
+ <a class="button is-light is-fullwidth" href="/location/how-to-use/dns" disabled>
+ {{ _("DNS") }}
+ </a>
</div>
</div>
</section>
--- /dev/null
+{% extends "../../base.html" %}
+
+{% block title %}{{ _("How To Use?") }} - {{ _("Python") }}{% end block %}
+
+{% block container %}
+ <section class="hero is-light">
+ <div class="hero-body">
+ <div class="container">
+ <nav class="breadcrumb" aria-label="breadcrumbs">
+ <ul>
+ <li>
+ <a href="/">
+ {{ _("Home") }}
+ </a>
+ </li>
+ <li>
+ <a href="/location">
+ {{ _("Location") }}
+ </a>
+ </li>
+ <li>
+ <a href="/location/how-to-use">
+ {{ _("How To Use?") }}
+ </a>
+ </li>
+ <li class="is-active">
+ <a href="#" aria-current="page">{{ _("Python") }}</a>
+ </li>
+ </ul>
+ </nav>
+
+ <h1 class="title">{{ _("Python") }}</h1>
+ </div>
+ </div>
+ </section>
+
+ <section class="section">
+ <div class="container">
+ <div class="columns">
+ <div class="column">
+ <div class="content">
+ <p>
+ <code>libloc</code> comes with native Python bindings which
+ are used by its main command-line tool
+ <a class="text-white" href="https://man-pages.ipfire.org/libloc/location.html">
+ <code>location</code>
+ </a>.
+ They are the most advanced bindings as they support reading
+ from the database as well as writing to it.
+ </p>
+ </div>
+ </div>
+
+ <div class="column is-narrow">
+ <figure class="image is-128x128">
+ <img src="{{ static_url("img/python-logo.svg") }}"
+ alt="{{ _("Python") }}">
+ </figure>
+ </div>
+ </div>
+
+ <div class="block">
+ <h6 class="title is-6">{{ _("Load the database") }}</h6>
+
+ <pre><code>Python 3.7.3 (default, Apr 3 2019, 05:39:12)
+[GCC 8.3.0] on linux
+Type "help", "copyright", "credits" or "license" for more information.
+>>> import location
+>>> d = location.Database("/usr/share/location/database.db")</code></pre>
+ </div>
+
+ <div class="block">
+ <h6 class="title is-6">{{ _("Search for an Autonomous System by Name") }}</h6>
+
+ <pre><code>>>> for i in d.search_as("Lightning Wire Labs"):
+... print(i)
+...
+AS204867 (Lightning Wire Labs GmbH)</code></pre>
+ </div>
+
+ <div class="block">
+ <h6 class="title is-6">{{ _("Lookup an IP Address") }}</h6>
+
+ <pre><code>>>> n = d.lookup("81.3.27.38")
+>>> n
+<location.Network 81.3.27.0/24>
+>>> n.asn
+24679
+>>> n.country_code
+'DE'</code></pre>
+ </div>
+ </div>
+ </section>
+{% end block %}
(r"/location/?", location.IndexHandler),
(r"/location/download", tornado.web.RedirectHandler, { "url" : "/location/install" }),
(r"/location/how\-to\-use", StaticHandler, { "template" : "location/how-to-use/index.html" }),
+ (r"/location/how\-to\-use/cli", StaticHandler, { "template" : "location/how-to-use/cli.html" }),
+ (r"/location/how\-to\-use/python", StaticHandler, { "template" : "location/how-to-use/python.html" }),
(r"/location/install", StaticHandler, { "template" : "location/install.html" }),
(r"/location/lookup/(.+)", location.LookupHandler),