https://github.com/denorg/get-ip
🌐 Get your public IP address in Deno
https://github.com/denorg/get-ip
deno denoland denorg ip ipv4 ipv6 typescript
Last synced: about 1 year ago
JSON representation
🌐 Get your public IP address in Deno
- Host: GitHub
- URL: https://github.com/denorg/get-ip
- Owner: denorg
- License: mit
- Created: 2020-05-23T03:22:41.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-03T11:28:40.000Z (over 5 years ago)
- Last Synced: 2024-10-17T18:46:34.479Z (over 1 year ago)
- Topics: deno, denoland, denorg, ip, ipv4, ipv6, typescript
- Language: TypeScript
- Homepage: https://denorg.github.io/get-ip/
- Size: 26.4 KB
- Stars: 7
- Watchers: 6
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# 🌐 Get IP
Get your public IP address in Deno.
[](https://github.com/denorg/get-ip/actions)
[](https://github.com/denorg/get-ip/blob/master/LICENSE)
[](https://github.com/denorg/get-ip/graphs/contributors)
[](https://denorg.github.io/starter/)
[](https://github.com/denorg)
[](https://github.com/denorg/get-ip)
[](https://github.com/semantic-release/semantic-release)
## ⭐ Getting started
Import the `getIP` function and use it:
```ts
import { getIP } from "https://deno.land/x/get_ip/mod.ts";
const getMyIP = async () => {
console.log(`Your public IP is ${await getIP({ipv6: true})}`);
}
getMyIP();
```
### CLI with [DPX](https://github.com/denorg/dpx)
After [installing DPX](https://github.com/denorg/dpx), you can directly use the CLI using the `dpx` command:
```bash
dpx get_ip
# 123.456.789.012
```
### CLI
Alternatively, you can use it directly from the CLI by using `deno run`:
```bash
deno run --allow-net https://deno.land/x/get_ip/cli.ts
# 123.456.789.012
```
You can also install it globally using the following:
```bash
deno install --allow-net -n get-ip https://deno.land/x/get_ip/cli.ts
```
Then, the package is available to run:
```bash
get_ip
# 123.456.789.012
```
### Configuration
Required permissions:
1. `--allow-net`
## 👩💻 Development
Run tests:
```bash
deno test --allow-net
```
## 📄 License
MIT © [Denorg](https://den.org.in)
A project by Denorg, the world's first Deno-focused community
organization and consulting company. Work with us →