missuo / FreeDuckDuckGo

Use DuckDuckGo for free with GPT-3.5-Turbo.
GNU General Public License v3.0
195 stars 63 forks source link

feat: Add ENABLE_DOMAIN_FRONTING options for duckduckgo #8

Closed excitedplus1s closed 2 months ago

excitedplus1s commented 2 months ago

duckduckgo 不校验 SNI 名称。 GFW 采用 DNS 污染 + SNI 阻断影响 duckduckgo.com的正常连接。 duck.ai 在其证书的备用名称里,未被污染和 SNI 阻断,且符合 AI 主题。 使用 duck.ai 解决 DNS污染 和 SNI 阻断问题。 其他未污染和阻断地区也可正常使用此方法。

excitedplus1s commented 2 months ago

原理 curl -H 'Host: duckduckgo.com' https://duck.ai/duckchat/v1/status 输出 {"status":"0"}

missuo commented 2 months ago
  1. You need to format the code
  2. You need to add your new domain as an option for US User.
excitedplus1s commented 2 months ago

It is now possible to control whether duck.ai is used or not via the env variable ENABLE_DOMAIN_FRONTING. Do I need to update it to README and compose.yaml (it's unenabled by default without adding it)? or keep it under our hat :see_no_evil:

missuo commented 2 months ago
  1. domainFronting why not bool?
  2. Why write a lot of repetitive code, such as specifying req.host twice?
excitedplus1s commented 2 months ago
  1. domainFronting why not bool?
  2. Why write a lot of repetitive code, such as specifying req.host twice?

1.You are right, domainFronting should be bool 2.Because req is reassigned after the req, err = http.NewRequest("POST", chatURL, bytes.NewBuffer(payloadBytes))