Golang Zakhireh – local go proxy for offline use

Golang Zakhireh – local go proxy for offline use
Photo by Domaintechnik Ledl.net / Unsplash

local go module proxy. offline first. air-gapped. sanctioned-country friendly.

go mod download fails on bad net?
firewall blocks proxy.golang.org?
no internet at all?
this fixes it.

runs locally. caches modules on disk. serves forever offline.

why i built it
corporate firewalls suck.
air-gapped labs.
sanctioned countries (iran, china, etc.) — upstream proxies often blocked or unreachable.
athens (https://github.com/gomods/athens) and gomods.io? powerful but heavy.
need docker-compose, config files, storage backends, sometimes databases.
too much for quick local setup or low-resource machines.

this is different.
single binary. minimal deps. hackable.
seed once on connected machine → copy cache → run offline forever.
no cloud. no external services. just http server.

main features

  • tiny dashboard: http://localhost:8811 — list modules, versions, sizes
  • manual upload: drop private .zip .mod .info via UI or curl /upload
  • GONOSUMDB support built-in
  • allow/deny lists: GOLANGZAKHIREH_ALLOW, GOLANGZAKHIREH_DENY
  • upstream fallback (default proxy.golang.org) — disable for pure offline

quick start (connected machine)

git clone https://github.com/GolangZakhireh/golang_zakhireh
cd golang_zakhireh
go run ./cmd/server

set proxy:

export GOPROXY=http://localhost:8811/proxy,direct
go get github.com/gin-gonic/gin

dashboard shows cache. download happens from upstream first time.

config env vars

export GOLANGZAKHIREH_PORT=:9000
export GOLANGZAKHIREH_DATA_DIR=/var/cache/go-modules
export GOLANGZAKHIREH_UPSTREAM=https://goproxy.io   # or empty for no upstream
export GONOSUMDB=github.com/mycompany/*
export GOLANGZAKHIREH_ALLOW=github.com/myorg/*
export GOLANGZAKHIREH_DENY=badmodule/*

sanctioned countries offline workflow

  1. use connected machine (vpn or outside sanctions). run proxy. go get everything your projects need. cache fills ./data/modules.
  2. copy whole data/modules dir to usb/drive.
  3. on offline/sanctioned machine: place data/modules at your DATA_DIR. start proxy.
    set GOPROXY=http://localhost:8811/proxy,direct
    (no upstream needed — set to empty or invalid if paranoid)
  4. go build / go test / go mod tidy works fully local.

private modules? upload via dashboard or curl on seed machine before copy.
example:

curl -X POST http://localhost:8811/upload \
  -F "module=github.com/mycompany/private" \
  -F "version=v1.0.0" \
  -F "[email protected]" \
  -F "[email protected]" \
  -F "[email protected]"

docker

docker-compose up -d

mounts to ./data/modules persistent

simple. lightweight. no bullshit deps. works where athens is overkill or blocked.

GitHub - GolangZakhireh/golang_zakhireh: local go module proxy. offline first. air-gapped. sanctioned-country friendly.
local go module proxy. offline first. air-gapped. sanctioned-country friendly. - GolangZakhireh/golang_zakhireh

Utils Repository

scrapes awesome-go. gets categories + latest versions. dumps to txt/csv

run on connected machine → get list → pre-download popular modules → copy cache over.
saves time seeding.

GitHub - GolangZakhireh/golang_zakhireh_utils: Script to fetch and generate a categorized (by Awesome Go) list of GitHub Go packages with latest versions.
Script to fetch and generate a categorized (by Awesome Go) list of GitHub Go packages with latest versions. - GolangZakhireh/golang_zakhireh_utils