diff --git a/.gitignore b/.gitignore index e41c73d..b7ee197 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ go.work.sum /migration_state.json /bin log.log -err.log \ No newline at end of file +err.log +i2pkeys +onionkeys +tlskeys \ No newline at end of file diff --git a/README.md b/README.md index 6d66d57..03d1d10 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,13 @@ Go-based tool for migrating GitLab repositories, users, groups, issues and relat More-or-less a port of [gitlab-to-gitea](https://git.autonomic.zone/kawaiipunk/gitlab-to-gitea) from python to Go because *fixing* python appears to be a thing I just can't get my mind around, but *rewriting* it? I'm actually OK at that. -Also includes: `cmd/forkfix`, for fixing fork relationships between migrated repositories by manipulating the gitea mysql database, `cmd/unmigrate` to delete everything from a gitea instance except for the admin users, and `cmd/johnconnor` which is a super-dangerous script for eliminating spam accounts from gitlab instances. +Also includes: + - `cmd/forkfix`, for fixing fork relationships between migrated repositories by manipulating the gitea sql database + - `cmd/unmigrate` to delete everything from a gitea instance except for the admin users + - `cmd/mirror` to set up a mirror from github to gitea + - `cmd/orgfix` to establish an organization's repositories as the "parent fork" by manipulating the gitea sql database + - `cmd/namefix` to discover repositories that have identical initial commit hashes but different names + - `cmd/johnconnor` which is a super-dangerous script for eliminating spam accounts from gitlab instances. ## Core Functionality @@ -18,7 +24,7 @@ Also includes: `cmd/forkfix`, for fixing fork relationships between migrated rep - Modular package structure instead of monolithic script - Configuration via environment variables rather than hardcoded values -- Added utility tools (`forkfix`, `unmigrate`, `johnconnor`) +- Added utility tools (`forkfix`, `unmigrate`, `johnconnor`, `mirror`, `orgfix`, `namefix`) - Database connectivity for commit action imports - Improved error handling with recovery mechanisms - Separation of API client code from migration logic diff --git a/gitlab/dialer.go b/gitlab/dialer.go index 1df1f5f..de056ea 100644 --- a/gitlab/dialer.go +++ b/gitlab/dialer.go @@ -3,46 +3,16 @@ package gitlab import ( "net" "net/http" - "net/url" - "strings" "time" - "github.com/go-i2p/onramp" -) - -var ( - Garlic, GarlicErr = onramp.NewGarlic("git-looseleaf", "127.0.0.1:7656", onramp.OPT_WIDE) - Onion, OnionErr = onramp.NewOnion("git-looseleaf") + metadialer "github.com/go-i2p/go-meta-dialer" ) func Dial(network, addr string) (net.Conn, error) { - // convert the addr to a URL - url, err := url.Parse(addr) - if err != nil { - return nil, err - } - // get the domain name - domain := url.Hostname() - // get the top-level domain - fr := strings.Split(domain, ".") - tld := fr[len(fr)-1] - switch tld { - case "i2p": - if GarlicErr != nil { - return nil, GarlicErr - } - // I2P is a special case, we need to use the garlic dialer - return Garlic.Dial("i2p", addr) - case "onion": - if OnionErr != nil { - return nil, OnionErr - } - // Onion is a special case, we need to use the onion dialer - return Onion.Dial("onion", addr) - default: - // For everything else, we can use the default dialer - return net.Dial(network, addr) + if metadialer.ANON { + metadialer.ANON = false } + return metadialer.Dial(network, addr) } func init() { diff --git a/go.mod b/go.mod index 5316327..80b7594 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/go-i2p/gitlab-to-gitea go 1.24.2 require ( + github.com/go-i2p/go-meta-dialer v0.0.0-20250501024057-715e91be3cfe github.com/go-i2p/onramp v0.33.92 github.com/go-sql-driver/mysql v1.9.2 github.com/google/go-github/v57 v57.0.0 diff --git a/go.sum b/go.sum index cd4c10b..afe37c5 100644 --- a/go.sum +++ b/go.sum @@ -7,6 +7,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/go-i2p/go-meta-dialer v0.0.0-20250501024057-715e91be3cfe h1:9Rxw2KtMCRKZHI4WavUAaatzKmc64V6kiYvcyTMHjeU= +github.com/go-i2p/go-meta-dialer v0.0.0-20250501024057-715e91be3cfe/go.mod h1:++xHSOvnGymRSyFbi9A9hztcfwKfU6/nJAtVxrNo8Zo= github.com/go-i2p/i2pkeys v0.0.0-20241108200332-e4f5ccdff8c4/go.mod h1:m5TlHjPZrU5KbTd7Lr+I2rljyC6aJ88HdkeMQXV0U0E= github.com/go-i2p/i2pkeys v0.33.10-0.20241113193422-e10de5e60708 h1:Tiy9IBwi21maNpK74yCdHursJJMkyH7w87tX1nXGWzg= github.com/go-i2p/i2pkeys v0.33.10-0.20241113193422-e10de5e60708/go.mod h1:m5TlHjPZrU5KbTd7Lr+I2rljyC6aJ88HdkeMQXV0U0E=