godns icon indicating copy to clipboard operation
godns copied to clipboard

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

Open lhbdhr opened this issue 1 year ago • 6 comments

我搜了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
    }
  }
}

lhbdhr avatar Apr 01 '23 07:04 lhbdhr

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

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"

wangzexi avatar Apr 20 '23 20:04 wangzexi

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

lhbdhr avatar Apr 21 '23 04:04 lhbdhr

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

TimothyYe avatar Apr 21 '23 15:04 TimothyYe

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

好的,非常感谢。

lhbdhr avatar Apr 21 '23 16:04 lhbdhr

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

hhyhhy avatar Jul 17 '24 02:07 hhyhhy

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

TimothyYe avatar Jul 23 '24 13:07 TimothyYe