V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
LxnChan
V2EX  ›  程序员

有办法代理 Google 的 API 吗

  •  
  •   LxnChan ·
    lxnchan · 2022-05-28 13:48:40 +08:00 · 2434 次点击
    这是一个创建于 670 天前的主题,其中的信息可能已经有所发展或是发生改变。

    想用 acme 申请 Google 的 SSL 证书,但是国内好像没有办法连接 Google 的 API 服务,用 Hosts 也不行。

    在 cloudflare 搞了个 jsproxy 但是 curl 一下会返回代理页。

    想问一下大家有没有什么好的解决方案。


    需要请求的地址:https://dv.acme-v02.api.pki.goog/directory

    应该返回的数据:

    {"newNonce":"https://dv.acme-v02.api.pki.goog/new-nonce","newAccount":"https://dv.acme-v02.api.pki.goog/new-account","newOrder":"https://dv.acme-v02.api.pki.goog/new-order","newAuthz":"https://dv.acme-v02.api.pki.goog/new-authz","revokeCert":"https://dv.acme-v02.api.pki.goog/revoke-cert","meta":{"termsOfService":"https://pki.goog/GTS-SA.pdf","website":"https://pki.goog","caaIdentities":["pki.goog"],"externalAccountRequired":true}}
    

    经过 jsproxy curl 到的数据:

    root@lxnchan-testbench-vm93-hwcloud-cn:~# curl 'https://proxy.mydomain.top/-----https://dv.acme-v02.api.pki.goog/directory'
    <html><head><meta charset=utf-8></head><body id=t><svg xmlns=http://www.w3.org/2000/svg width=100% height=100% viewBox="0 0 100 100" preserveAspectRatio=xMidYMid fill=none><circle cx=50 cy=50 r=25.944 stroke=#93dbe9><animate attributeName=r calcMode=spline values=0;40 keyTimes=0;1 dur=1 keySplines="0 0.2 0.8 1" begin=-0.5s repeatCount=indefinite stroke-width=2 /><animate attributeName=opacity calcMode=spline values=1;0 keyTimes=0;1 dur=1 keySplines="0.2 0 0.8 1" begin=-0.5s repeatCount=indefinite stroke-width=2 /></circle><circle cx=50 cy=50 r=40 stroke=#689cc5><animate attributeName=r calcMode=spline values=0;40 keyTimes=0;1 dur=1 keySplines="0 0.2 0.8 1" begin=0s repeatCount=indefinite stroke-width=2 /><animate attributeName=opacity calcMode=spline values=1;0 keyTimes=0;1 dur=1 keySplines="0.2 0 0.8 1" begin=0s repeatCount=indefinite stroke-width=2 /></circle></svg><script>function a(){var e=Date.now();try{var t=+sessionStorage._ts||0;if((sessionStorage._ts=e)-t<100)return setTimeout(a,5e3)}catch(r){}location.reload()}function i(e){n(e.message)}function n(e){t.innerHTML=e}!function s(){if(self.isSecureContext)if(self.ReadableStream){var e=navigator.serviceWorker;if(e)e.register(function r(){return location.pathname.replace(/\/-+https?:.+/,"").replace(/\w+\.\w+$/,"").replace(/\/*$/,"/")}()+"sw.js").then(a)["catch"](i);else{var t=navigator.userAgent;/Firefox/.test(t)?n("本网站不支持 FireFox 隐身模式"):/iPhone|iPad/.test(t)&&n("iOS 上请使用 Safari 浏览器")}}else n("请使用最新的 HTML5 浏览器");else n("本程序需要 HTTPS 站点")}()</script></body></html>
    
    8 条回复    2022-05-29 20:20:46 +08:00
    Kinnice
        1
    Kinnice  
       2022-05-28 16:04:43 +08:00 via Android
    jsproxy 是基于 js 的(浏览器),你应该使用 tcp 代理
    chxf
        2
    chxf  
       2022-05-28 16:13:04 +08:00
    acme 跑 linux 上?搞个 https_proxy 可以的吧,不过我用 let's encrypt,域名在阿里云,不用代理。
    zoharSoul
        3
    zoharSoul  
       2022-05-28 17:06:37 +08:00
    我也想知道, 比如接个三方登录之类的
    SunsetShimmer
        4
    SunsetShimmer  
       2022-05-28 19:32:19 +08:00   ❤️ 1
    yankebupt
        5
    yankebupt  
       2022-05-28 23:23:13 +08:00
    不懂瞎说
    申请证书这个不是对方要验证你的发起 ip 地址和被申请地址是否同 ip 么?用代理 ip 是不是就变了?
    还是我不知道有什么新的规定?
    shansing
        6
    shansing  
       2022-05-29 10:51:06 +08:00   ❤️ 1
    https://github.com/dlundquist/sniproxy/ 或者直接用 nginx 相关功能。


    @yankebupt ACME 支持 HTTP 认证、DNS 认证,都是对方主动发起请求,跟请求 API 的 IP 地址无关。
    cnrting
        7
    cnrting  
       2022-05-29 15:51:46 +08:00
    我试了 hosts 可以啊卤煮
    Showfom
        8
    Showfom  
       2022-05-29 20:20:46 +08:00
    @yankebupt # 5 不需要
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   959 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 21:38 · PVG 05:38 · LAX 14:38 · JFK 17:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.