Reimplement AddPeer and RemovePeer for admin socket (#951)

* Reimplement AddPeer and RemovePeer for admin socket

Fix #950

* Disconnect the peer on `removePeer`

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
This commit is contained in:
ehmry 2022-10-02 06:35:43 -05:00 committed by GitHub
parent c922eba2d8
commit 7db934488e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 97 additions and 73 deletions

12
src/admin/removepeer.go Normal file
View file

@ -0,0 +1,12 @@
package admin
type RemovePeerRequest struct {
Uri string `json:"uri"`
Sintf string `json:"interface,omitempty"`
}
type RemovePeerResponse struct{}
func (a *AdminSocket) removePeerHandler(req *RemovePeerRequest, res *RemovePeerResponse) error {
return a.core.RemovePeer(req.Uri, req.Sintf)
}