Skip to content

Commit

Permalink
gitd: support ?go-get=1
Browse files Browse the repository at this point in the history
  • Loading branch information
navigaid committed May 5, 2024
1 parent 7bb2306 commit 0731432
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 7 additions & 0 deletions apps/gitd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ var services = map[string]Service{

func Handler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if r.URL.Query().Get("go-get") == "1" {
template := `<meta name="go-import" content="%s git %s">`
root := r.Host
repo := fmt.Sprintf("https://%s%s", root, r.URL.Path)
fmt.Fprintf(w, template, root, repo)
return
}
// log.Printf("%s %s %s %s", r.RemoteAddr, r.Method, r.URL.Path, r.Proto)
for match, service := range services {
re, err := regexp.Compile(match)
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ require (
github.com/vmware-labs/wasm-workers-server v1.7.0
// github.com/webteleport/caddy-webteleport v0.0.1
github.com/webteleport/auth v0.0.8
github.com/webteleport/relay v0.4.19
github.com/webteleport/relay v0.4.22
github.com/webteleport/utils v0.2.15
github.com/webteleport/webteleport v0.5.26
github.com/webteleport/webteleport v0.5.27
github.com/webteleport/wtf v0.1.22
golang.org/x/net v0.24.0
google.golang.org/grpc v1.62.1
Expand Down Expand Up @@ -156,7 +156,6 @@ require (
github.com/v2fly/BrowserBridge v0.0.0-20210430233438-0570fc1d7d08 // indirect
github.com/v2fly/VSign v0.0.0-20201108000810-e2adc24bf848 // indirect
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e // indirect
github.com/webteleport/transport v0.0.0 // indirect
github.com/xanzy/go-gitlab v0.100.0 // indirect
github.com/xtaci/kcp-go/v5 v5.6.1 // indirect
github.com/xtaci/smux v1.5.24 // indirect
Expand Down

0 comments on commit 0731432

Please sign in to comment.