https://github.com/onionj/ip
A TCP server written in Go that returns the client's IP address and country. It supports various response modes, including TCP plain text, HTTP plain text, HTTP JSON and animation!.
https://github.com/onionj/ip
golang ip myip tcp tcp-animation yourip
Last synced: about 2 months ago
JSON representation
A TCP server written in Go that returns the client's IP address and country. It supports various response modes, including TCP plain text, HTTP plain text, HTTP JSON and animation!.
- Host: GitHub
- URL: https://github.com/onionj/ip
- Owner: onionj
- License: mit
- Created: 2023-06-05T08:37:57.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-08-16T09:02:05.000Z (9 months ago)
- Last Synced: 2025-03-17T17:55:50.974Z (about 2 months ago)
- Topics: golang, ip, myip, tcp, tcp-animation, yourip
- Language: Go
- Homepage: http://yourip.top
- Size: 2.13 MB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YourIP Server
YourIP Server is a TCP server written in Go that returns the client's IP address. It supports various response modes, including tcp plain text, HTTP plain text, and HTTP JSON. Additionally, it features a fun IP streaming animation.
You can access the YourIP Server at [yourip.top](http://yourip.top).
## Run Server:
```bash
make
yourip -b 80 -g
``````
--bind -b
The address to bind the TCP server to. (default ":8080")
--geolocation -g
Optional IP geolocation service. (its downlaod Country IP blocks database (70MB) )
```## How it works
The server uses the `net` package in Go to resolve the TCP address, start a listener, and accept incoming connections. It sets a deadline of one minute for each connection and responds with an HTTP 200 OK message containing the client's IP address.
## Response Modes
- **Plain Text:** Suitable for pure TCP connections like NetCat.
* Netcat: `echo -e "" | nc yourip.top 80`
- **HTTP Text:** Designed for browsers and `curl` requests.
* Curl: `curl http://yourip.top`
* Open this addres on browser `http://yourip.top`
* Netcat: `echo -e "GET /" | nc yourip.top 80`
- **HTTP JSON:** Designed for browsers and `curl` requests.
* Curl: `curl http://yourip.top/json`
* Open this addres on browser `http://yourip.top`
* Netcat: `echo -e "GET /json" | nc yourip.top 80`
- **Animation:** Suitable for pure TCP connections like NetCat.
* Netcat: `echo -e "1" | nc yourip.top 80` (Banner)
* Netcat: `echo -e "2" | nc yourip.top 80` (Flight)## Animation Mode
The server can stream the client's IP address in an animated format.\
for example connect to the server with netcat (`nc`) and send `1` or `2`
or use these commands: \
`echo -e "1" | nc yourip.top 80` \
`echo -e "2" | nc yourip.top 80`[](./docs_file/example.mp4)
## License
This project is licensed under the [MIT License](https://github.com/onionj/ip/blob/master/LICENSE).