mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-24 20:07:45 +08:00
20 lines
356 B
Go
20 lines
356 B
Go
package corehttp
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
core "github.com/jbenet/go-ipfs/core"
|
|
)
|
|
|
|
func GatewayOption(writable bool) ServeOption {
|
|
return func(n *core.IpfsNode, mux *http.ServeMux) error {
|
|
gateway, err := newGatewayHandler(n, writable)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
mux.Handle("/ipfs/", gateway)
|
|
mux.Handle("/ipns/", gateway)
|
|
return nil
|
|
}
|
|
}
|