Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lhbdhr opened this issue Apr 1, 2023 · 6 comments
Open

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

lhbdhr opened this issue Apr 1, 2023 · 6 comments
Assignees

Comments

@lhbdhr
Copy link

lhbdhr commented Apr 1, 2023

我搜了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
Copy link

wangzexi commented Apr 20, 2023

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

if provider.configuration.IPType == "" || strings.ToUpper(provider.configuration.IPType) == utils.IPV4 {
value.Add("record_type", "A")
} else if strings.ToUpper(provider.configuration.IPType) == utils.IPV6 {
value.Add("record_type", "AAAA")

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

# 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
Copy link
Author

lhbdhr commented Apr 21, 2023

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

@TimothyYe
Copy link
Owner

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

@lhbdhr
Copy link
Author

lhbdhr commented Apr 21, 2023

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

好的,非常感谢。

@TimothyYe TimothyYe self-assigned this Apr 22, 2023
@hhyhhy
Copy link

hhyhhy commented Jul 17, 2024

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

@TimothyYe
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants