g icon indicating copy to clipboard operation
g copied to clipboard

如果我想使用自己的 Nexus raw 代理应该何解

Open LiaoSirui opened this issue 1 year ago • 6 comments

https://github.com/voidint/g/blob/master/collector/collector.go

Image

LiaoSirui avatar Feb 24 '25 10:02 LiaoSirui

我没接触过,有没有现成的公开仓库?有时间会研究下怎么接入

voidint avatar Feb 25 '25 02:02 voidint

没有现成的仓库,可以给您提供 docker-compose 吗

其实约等于自己建立的 nginx 服务器,但是这个里面的文件,是上游 https://golang.org/dl/ 的文件,选中其中一个以后,Nexus 会替代进行缓存

LiaoSirui avatar Feb 26 '25 01:02 LiaoSirui


services:
  nexus:
    image: docker.io/sonatype/nexus3:3.77.1
    restart: always
    networks:
      - nexus
    ports:
      - "${INST_HTTP_PORT}:8081"
    environment:
      TZ: Asia/Shanghai
      NEXUS_SECRETS_KEY_FILE: "/nexus-secret-keys.json"
      INST_NEXUS3_ADMIN: ${INST_NEXUS3_ADMIN}
      INST_NEXUS3_ADMIN_PASS: ${INST_NEXUS3_ADMIN_PASS}
    volumes:
      - "${INST_DATA_DIR}:/nexus-data"
      - "../nexus-secret-keys.json:/nexus-secret-keys.json"
networks:
  nexus:
    ipam:
      driver: default
      config:
        - subnet: 172.28.2.0/24
          ip_range: 172.28.2.0/24
          gateway: 172.28.2.254

nexus-secret-keys.json 文件参考

{
    "active": "nexus-inst-key",
    "keys": [
        {
            "id": "nexus-inst-key",
            "key": "this is key"
        }
    ]
}

LiaoSirui avatar Feb 26 '25 01:02 LiaoSirui

仓库参考配置

Image

由于域名是自定义的,所以触发了规则,collector not found

LiaoSirui avatar Feb 26 '25 01:02 LiaoSirui

比如你的nexus配置的remote地址是https://mirror.nju.edu.cn/golang/, 自己的地址是 https://xxx.abc.com/golang-proxy,G_MIRROR 填写 “fancyindex|https://xxx.abc.com/golang-proxy” 就行了

chengongliang avatar Apr 17 '25 03:04 chengongliang

比如你的nexus配置的remote地址是https://mirror.nju.edu.cn/golang/, 自己的地址是 https://xxx.abc.com/golang-proxy,G_MIRROR 填写 “fancyindex|https://xxx.abc.com/golang-proxy” 就行了

承接上面@LiaoSirui的环境

export G_MIRROR="fancyindex|https://xxx.abc.com/golang-dl/"

依然无效,g ls-remote stable没有任何输出

Shanwer avatar Jun 25 '25 07:06 Shanwer