Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/containers/gvisor-tap-vsock v0.8.9
github.com/gofrs/flock v0.13.1
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/inetaf/tcpproxy v0.0.0-20260515195445-c159a6051109
github.com/insomniacslk/dhcp v0.0.0-20260901064844-234b97448fae
github.com/moby/sys/mountinfo v0.7.2
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 h1:EEHtgt9IwisQ2AZ4pI
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/inetaf/tcpproxy v0.0.0-20260515195445-c159a6051109 h1:H3ztMPCBcyG60Ks0plTncU3Vs6jIrxhn3nEThpMEpo4=
github.com/inetaf/tcpproxy v0.0.0-20260515195445-c159a6051109/go.mod h1:Di7LXRyUcnvAcLicFhtM9/MlZl/TNgRSDHORM2c6CMI=
github.com/insomniacslk/dhcp v0.0.0-20260901064844-234b97448fae h1:nXGg65fXsylSUTNNWwvHuQsXev7mhIzQTnZREPTbWzs=
Expand Down
18 changes: 6 additions & 12 deletions pkg/api/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"net/http"
"strconv"

"github.com/gorilla/mux"
"github.com/rootless-containers/rootlesskit/v3/pkg/api"
"github.com/rootless-containers/rootlesskit/v3/pkg/httputil"
"github.com/rootless-containers/rootlesskit/v3/pkg/port"
Expand Down Expand Up @@ -94,11 +93,7 @@ func (b *Backend) DeletePort(w http.ResponseWriter, r *http.Request) {
b.onPortDriverNil(w, r)
return
}
idStr, ok := mux.Vars(r)["id"]
if !ok {
httputil.WriteError(w, r, errors.New("id not specified"), http.StatusBadRequest)
return
}
idStr := r.PathValue("id")
id, err := strconv.Atoi(idStr)
if err != nil {
httputil.WriteError(w, r, fmt.Errorf("bad id %s: %w", idStr, err), http.StatusBadRequest)
Expand Down Expand Up @@ -144,10 +139,9 @@ func (b *Backend) GetInfo(w http.ResponseWriter, r *http.Request) {
w.Write(m)
}

func AddRoutes(r *mux.Router, b *Backend) {
v1 := r.PathPrefix("/v1").Subrouter()
v1.Path("/ports").Methods("GET").HandlerFunc(b.GetPorts)
v1.Path("/ports").Methods("POST").HandlerFunc(b.PostPort)
v1.Path("/ports/{id}").Methods("DELETE").HandlerFunc(b.DeletePort)
v1.Path("/info").Methods("GET").HandlerFunc(b.GetInfo)
func AddRoutes(r *http.ServeMux, b *Backend) {
r.HandleFunc("GET /v1/ports", b.GetPorts)
r.HandleFunc("POST /v1/ports", b.PostPort)
r.HandleFunc("DELETE /v1/ports/{id}", b.DeletePort)
r.HandleFunc("GET /v1/info", b.GetInfo)
}
3 changes: 1 addition & 2 deletions pkg/parent/parent.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"syscall"

"github.com/gofrs/flock"
"github.com/gorilla/mux"
"github.com/rootless-containers/rootlesskit/v3/pkg/api/router"
"github.com/rootless-containers/rootlesskit/v3/pkg/messages"
"github.com/rootless-containers/rootlesskit/v3/pkg/network"
Expand Down Expand Up @@ -503,7 +502,7 @@ type apiCloser interface {
}

func listenServeAPI(socketPath string, backend *router.Backend) (apiCloser, error) {
r := mux.NewRouter()
r := http.NewServeMux()
router.AddRoutes(r, backend)
srv := &http.Server{Handler: r}
err := os.RemoveAll(socketPath)
Expand Down