This repository has been archived on 2024-07-16. You can view files and clone it, but cannot push or open issues or pull requests.
www.local-ip.sh/app/routes/_index.tsx

100 lines
3.1 KiB
TypeScript
Raw Permalink Normal View History

2023-12-22 22:59:14 +00:00
import type { LinksFunction } from "@remix-run/node";
2023-12-12 23:15:37 +00:00
import styles from "../styles/index.css";
2023-12-22 22:59:14 +00:00
export const links: LinksFunction = () => [{ rel: "stylesheet", href: styles }];
2023-12-11 14:19:17 +00:00
export default function Index() {
2023-12-12 23:15:37 +00:00
return (
<>
<header>
<pre>
2023-12-22 22:59:14 +00:00
{` _ _ _ _
| | | | (_) | |
| | ___ ___ __ _| | _ _ __ ___| |__
| |/ _ \\ / __/ _\` | |_____| | '_ \\ / __| '_ \\
| | (_) | (_| (_| | |_____| | |_) |\\__ \\ | | |
|_|\\___/ \\___\\__,_|_| |_| .__(_)___/_| |_|
| |
|_|
2023-12-12 23:15:37 +00:00
`}
</pre>
</header>
<main>
<section>
2023-12-22 22:59:14 +00:00
<header>
<strong>What is local-ip.sh?</strong>
</header>
2023-12-12 23:15:37 +00:00
<main>
<article>
2023-12-22 22:59:14 +00:00
local-ip.sh is a magic domain name that provides wildcard DNS for any IP address. It is
heavily inspired by <a href="http://local-ip.co">local-ip.co</a>,{" "}
<a href="https://sslip.io">sslip.io</a>, and <a href="https://xip.io">xip.io</a>.
2023-12-12 23:15:37 +00:00
</article>
<article>
2023-12-22 22:59:14 +00:00
Quick example, say your LAN IP address is <strong>192.168.1.10</strong>. Using local-ip.sh,
<br />
<br />
<pre
dangerouslySetInnerHTML={{
__html: ` <strong>192.168.1.10</strong>.local-ip.sh resolves to 192.168.1.10
2023-12-12 23:15:37 +00:00
dots.<strong>192.168.1.10</strong>.local-ip.sh resolves to 192.168.1.10
dashes.<strong>192-168-1-10</strong>.local-ip.sh resolves to 192.168.1.10`,
2023-12-22 22:59:14 +00:00
}}
/>
2023-12-12 23:15:37 +00:00
</article>
<article>
2023-12-22 22:59:14 +00:00
...and so on. You can use these domains to access virtual hosts on your development web
server from devices on your local network. No configuration required!
2023-12-12 23:15:37 +00:00
</article>
<article>
2023-12-22 22:59:14 +00:00
The best part is, you can serve your content over HTTPS with our TLS certificate for{" "}
<code>*.local-ip.sh</code>:
2023-12-12 23:15:37 +00:00
<ul>
2023-12-22 22:59:14 +00:00
<li>
<a href="/server.pem">server.pem</a>
</li>
<li>
<a href="/server.key">server.key</a>
</li>
2023-12-12 23:15:37 +00:00
</ul>
2023-12-22 22:59:14 +00:00
Be aware that wildcard certificates are not recursive, meaning they don't match
"sub-subdomains". <br />
In our case, this certificate will only match subdomains of <code>local-ip.sh</code> such as{" "}
<code>192-168-1-10.local-ip.sh</code> where dashes separate the numbers that make up the IP
address.
2023-12-12 23:15:37 +00:00
</article>
</main>
</section>
<section>
2023-12-22 22:59:14 +00:00
<header>
<strong>How does it work?</strong>
</header>
2023-12-12 23:15:37 +00:00
<main>
<article>
2023-12-22 22:59:14 +00:00
local-ip.sh runs publicly a{" "}
<a href="https://git.mokhtar.dev/mokhtar/local-ip.sh">custom DNS server</a>. When your
computer looks up a local-ip.sh domain, the local-ip.sh DNS server resolves to the IP
address it extracts from the domain.
2023-12-12 23:15:37 +00:00
</article>
<article>
2023-12-22 22:59:14 +00:00
The TLS certificate is obtained from Let's Encrypt and renewed up to a month before it
expires.
2023-12-12 23:15:37 +00:00
</article>
</main>
</section>
</main>
<footer className="copyright">
© {new Date().getFullYear()} <a href="https://www.mokhtar.dev">Mokhtar Mial</a>
</footer>
</>
);
2023-12-11 14:19:17 +00:00
}