19 lines
563 B
Go
19 lines
563 B
Go
package chi
|
|
|
|
import (
|
|
"crypto/rsa"
|
|
|
|
peering "forge.cadoles.com/Cadoles/go-http-peering"
|
|
"forge.cadoles.com/Cadoles/go-http-peering/server"
|
|
"github.com/go-chi/chi"
|
|
)
|
|
|
|
func Mount(r chi.Router, store peering.Store, key *rsa.PublicKey, funcs ...server.OptionFunc) {
|
|
r.Post(peering.AdvertisePath, server.AdvertiseHandler(store, key, funcs...))
|
|
r.Group(func(r chi.Router) {
|
|
r.Use(server.Authenticate(store, key, funcs...))
|
|
r.Post(peering.UpdatePath, server.UpdateHandler(store, funcs...))
|
|
r.Post(peering.PingPath, server.PingHandler(store, funcs...))
|
|
})
|
|
}
|