vole
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software:2222/vole.git
A free and open-source forge that lives in your Git repo.
Name the configured host in the SSH clone link
268b93688db5dd045cf92f61dc0922919b074fc6 · Keenan Nemetz · 1d ago · parent 2c988ecd
Name the configured host in the SSH clone link ssh_addr is a bind address, so an instance listening on 0.0.0.0 showed ssh://git@0.0.0.0:2222/... in the clone menu. Take the host from public_url, which is the configured name, and keep ssh_addr for the port. The instance repository page reads the same helper.
server/web/transport_test.go +28
| @@ -13,6 +13,34 @@ import ( | |||
| 13 | 13 | "github.com/rodent-software/vole/forge/config" | |
| 14 | 14 | ) | |
| 15 | 15 | ||
| 16 | // The SSH link has to name a host a person can connect to. ssh_addr is a bind | ||
| 17 | // address, so a configured public_url names the instance and the listener only | ||
| 18 | // contributes the port. | ||
| 19 | func TestSSHURLUsesTheConfiguredHost(t *testing.T) { | ||
| 20 | t.Parallel() | ||
| 21 | cases := []struct { | ||
| 22 | name string | ||
| 23 | addr string | ||
| 24 | public string | ||
| 25 | wantPrefix string | ||
| 26 | }{ | ||
| 27 | {"wildcard bind, configured name", "0.0.0.0:2222", "https://rodent.software", "ssh://git@rodent.software:2222/"}, | ||
| 28 | {"default port is not written", "0.0.0.0:22", "https://forge.example.com", "ssh://git@forge.example.com/"}, | ||
| 29 | {"no public_url falls back to the listener", "127.0.0.1:2222", "", "ssh://git@127.0.0.1:2222/"}, | ||
| 30 | {"ipv6 listener keeps its brackets", "[::1]:2222", "", "ssh://git@[::1]:2222/"}, | ||
| 31 | } | ||
| 32 | for _, c := range cases { | ||
| 33 | c := c | ||
| 34 | t.Run(c.name, func(t *testing.T) { | ||
| 35 | t.Parallel() | ||
| 36 | w := &Web{Cfg: &config.Config{SSHAddr: c.addr, PublicURL: c.public}} | ||
| 37 | if got, want := w.sshURL("demo"), c.wantPrefix+"demo.git"; got != want { | ||
| 38 | t.Fatalf("sshURL = %q, want %q", got, want) | ||
| 39 | } | ||
| 40 | }) | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 16 | 44 | // TestCloneURLPrefersTheConfiguredOrigin: a link the browser hands to a terminal | |
| 17 | 45 | // must not be a link an attacker chose with a Host header. | |
| 18 | 46 | func TestCloneURLPrefersTheConfiguredOrigin(t *testing.T) { | |