myip/README.md

102 lines
2.9 KiB
Markdown
Raw Normal View History

2021-10-15 08:17:56 +00:00
# Myip
a tool that can get your public ip
2021-10-16 18:22:55 +00:00
```
2021-10-15 16:58:49 +00:00
myip is a easy way to get public ip of current system.
Usage:
myip [flags]
myip [command]
Available Commands:
completion generate the autocompletion script for the specified shell
help Help about any command
2021-10-16 18:22:55 +00:00
local short hand for `myip -altc --no-pub`
2021-10-15 16:58:49 +00:00
serve Simple server that returns the resolved IP.
version version
2021-10-15 08:17:56 +00:00
2021-10-15 16:58:49 +00:00
Flags:
-a, --all show local ip
--cron run as cron service
2021-10-15 16:58:49 +00:00
-h, --help help for myip
-u, --host string hostname to connect (default "kumoly.io")
-l, --list show list
-n, --name string tell the server who you are
2021-10-15 16:58:49 +00:00
--no-pub disable PublicIP
-p, --port string server port to connect (default "5080")
2021-10-16 18:22:55 +00:00
-c, --pretty show table cell, must used with --list
2021-10-15 16:58:49 +00:00
--secure use https
-s, --spec string hostname to connect (default "0 */5 * * * *")
2021-10-15 16:58:49 +00:00
-t, --title show title, used with --list
-v, --version version for myip
Use "myip [command] --help" for more information about a command.
2021-10-15 16:58:49 +00:00
```
2021-10-15 17:20:39 +00:00
2021-10-16 21:23:55 +00:00
## Install
```
sudo rm -f /usr/local/bin/myip
sudo sh -c "curl -fsSL https://release.kumoly.io/tools/myip/0.1.6/linux/amd64 | tar -C /usr/local/bin/ -xz"
```
2021-10-15 17:20:39 +00:00
## Docker
### Server
2021-10-15 17:20:39 +00:00
```shell
docker pull hub.kumoly.io/tools/myip:latest
docker run --name myip-server -d -p 5080:5080 --restart=always hub.kumoly.io/tools/myip
```
2021-10-15 19:15:49 +00:00
Or you can use docker-compose.yaml
```yaml
services:
myip:
image: hub.kumoly.io/tools/myip
container_name: myip-server
restart: always
ports:
- 5080:5080
volumes:
- /etc/localtime:/etc/localtime:ro
2021-10-16 18:22:55 +00:00
- ./log:/var/log
```
### Client
```shell
docker pull hub.kumoly.io/tools/myip:latest
docker run --name myip -d --restart=always hub.kumoly.io/tools/myip myip --cron --spec "@hourly"
```
2021-10-15 19:15:49 +00:00
## Cron
```
2021-10-18 01:14:30 +00:00
field name | Mandatory? | Allowed values | Allowed special characters
2021-10-15 19:15:49 +00:00
---------- | ---------- | -------------- | --------------------------
Seconds | Yes | 0-59 | * / , -
Minutes | Yes | 0-59 | * / , -
Hours | Yes | 0-23 | * / , -
Day of month | Yes | 1-31 | * / , - ?
Month | Yes | 1-12 or JAN-DEC | * / , -
Day of week | Yes | 0-6 or SUN-SAT | * / , - ?
Entry | Description | Equivalent To
----- | ----------- | -------------
@yearly (or @annually) | Run once a year, midnight, Jan. 1st | 0 0 0 1 1 *
@monthly | Run once a month, midnight, first of month | 0 0 0 1 * *
@weekly | Run once a week, midnight between Sat/Sun | 0 0 0 * * 0
@daily (or @midnight) | Run once a day, midnight | 0 0 0 * * *
@hourly | Run once an hour, beginning of hour | 0 0 * * * *
@every <duration>
2021-10-15 19:15:49 +00:00
```
**Duration**: `myip -altc --cron --spec "@every 5m"`