Restore removePeer method

This commit is contained in:
Neil Alexander 2023-10-22 10:27:41 +01:00
parent 80e56eafcd
commit 73c6c25bd9
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 66 additions and 40 deletions

View file

@ -1,5 +1,10 @@
package admin
import (
"fmt"
"net/url"
)
type RemovePeerRequest struct {
Uri string `json:"uri"`
Sintf string `json:"interface,omitempty"`
@ -8,5 +13,9 @@ type RemovePeerRequest struct {
type RemovePeerResponse struct{}
func (a *AdminSocket) removePeerHandler(req *RemovePeerRequest, res *RemovePeerResponse) error {
return a.core.RemovePeer(req.Uri, req.Sintf)
u, err := url.Parse(req.Uri)
if err != nil {
return fmt.Errorf("unable to parse peering URI: %w", err)
}
return a.core.RemovePeer(u, req.Sintf)
}