TimothyYe / godns

A dynamic DNS client tool that supports AliDNS, Cloudflare, Google Domains, DNSPod, HE.net & DuckDNS & DreamHost, etc, written in Go.
https://timothyye.github.io/godns/
Apache License 2.0
1.52k stars 224 forks source link

同时更新IPv4和IPv6的配置文件怎么写呀? #203

Open lhbdhr opened 1 year ago

lhbdhr commented 1 year ago

我搜了issue,看功能是支持的。但是看readme还是没明白应该怎么写,请求大佬支援。 另外v4和v6可以用同一个域名吗?

{
  "provider": "Cloudflare",
  "login_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "domains": [
    {
      "domain_name": "xxxxxxxxxx.com",
      "sub_domains": ["plex"]
    }
  ],
  "resolver": "8.8.8.8",
  "ip_urls": ["https://api-ipv4.ip.sb/ip"],
  "ipv6_urls": ["https://api6.ipify.org/"],
  "ip_type": "IPv4/IPv6",    // 我这里填写了这个,但是不管用。
  "interval": 300,
  "socks5_proxy": "127.0.0.1:7890",
  "use_proxy": true,
  "debug_info": true,
  "proxied": false,
  "notify": {
    "telegram": {
      "enabled": true,
      "bot_api_key": "xxxxxxxxxxxxxxxxxx",
      "chat_id": "xxxxxxxxxxxxxxxx",
      "message_template": "Domain *{{ .Domain }}* is updated to %0A{{ .CurrentIP }}",
      "use_proxy": false
    }
  }
}
wangzexi commented 1 year ago

我看了下代码,没有同时支持的逻辑。

https://github.com/TimothyYe/godns/blob/cc58c26776eac75abcd77789316377dcc8922819/internal/provider/dnspod/dnspod_provider.go#L125-L128

我是写了两个配置文件,分别运行。

# docker-compose.yaml

version: "3.9"

services:

  godns-ipv4:
    image: timothyye/godns:latest
    restart: unless-stopped
    network_mode: host
    command: -c /IPv4.yaml
    volumes:
      - ./IPv4.yaml:/IPv4.yaml

  godns-ipv6:
    image: timothyye/godns:latest
    restart: unless-stopped
    network_mode: host
    command: -c /IPv6.yaml
    volumes:
      - ./IPv6.yaml:/IPv6.yaml
# IPv4.yaml

provider: DNSPod
login_token: "123456,aaaaaaaaaaaaaaaaaaaaaaaa"
domains:
  - domain_name: example.com
    sub_domains:
      - www
ip_urls: [https://4.ipw.cn]
ip_type: IPv4
interval: 300
resolver: 8.8.8.8
# IPv6.yaml

provider: DNSPod
login_token: "123456,aaaaaaaaaaaaaaaaaaaaaaaa"
domains:
  - domain_name: example.com
    sub_domains:
      - www
ipv6_urls: [https://6.ipw.cn]
ip_type: IPv6
interval: 300
resolver: "2001:4860:4860::8888"
lhbdhr commented 1 year ago

跑两个实例是可以解决问题,但是不太优雅

TimothyYe commented 1 year ago

后续版本可以更新成同时更新IPv4和IPv6

lhbdhr commented 1 year ago

后续版本可以更新成同时更新IPv4和IPv6

好的,非常感谢。

hhyhhy commented 4 months ago

同时支持的配置文件打算怎么写? both 或者 dual? 我可以看下能不能帮上什么忙。

TimothyYe commented 4 months ago

改动还有点大,得从最底层改起