4
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2025-06-17 19:56:06 +00:00

Restore removePeer method

This commit is contained in:
Neil Alexander
2023-10-22 10:27:41 +01:00
parent 80e56eafcd
commit 73c6c25bd9
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)
}