From c0ea8e9196bf57befe38d718bad4cc36348e7867 Mon Sep 17 00:00:00 2001 From: Jenga Phoenix Date: Fri, 24 May 2019 01:16:00 -0500 Subject: [PATCH] Added bootstrap calls --- main.lisp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.lisp | 8 ++++++++ 2 files changed, 60 insertions(+) diff --git a/main.lisp b/main.lisp index 76d96f2..bf116b5 100644 --- a/main.lisp +++ b/main.lisp @@ -225,6 +225,58 @@ (gethash "Size" result)))) + +;; ------------------------------------- +;; BOOTSTRAP CALLS + +;; NIL → LIST +(defun bootstrap () + "Return a list of bootstrap peers + /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap" + (bind-api-result + (ipfs-call "bootstrap" '()) + (gethash "Peers" result))) + +;; NIL → LIST +(defun bootstrap/list () + "Return a list of bootstrap peers + /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap-list" + (bootstrap)) + +;; STRING → LIST +(defun bootstrap/add (peer) + "Add a peer to the bootstrap list + /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap-add" + (bind-api-result + (ipfs-call "bootstrap/add" `(("arg" ,peer))) + (gethash "Peers" result))) + +;; NIL → LIST +(defun bootstrap/add/default () + "Add default peers to the bootstrap list + /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap-add-default" + (bind-api-result + (ipfs-call "bootstrap/add/default" '()) + (gethash "Peers" result))) + +;; STRING → LIST +(defun bootstrap/rm (peer) + "Remove a peer from the bootstrap list + /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap-rm" + (bind-api-result + (ipfs-call "bootstrap/rm" `(("arg" ,peer))) + (gethash "Peers" result))) + +;; NIL → LIST +(defun bootstrap/rm/all (peer) + "Remove a peer from the bootstrap list + /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap-rm" + (bind-api-result + (ipfs-call "bootstrap/rm/all" '()) + (gethash "Peers" result))) + + + ;; ------------------------------------- ;; CONFIG CALLS diff --git a/package.lisp b/package.lisp index aa1a54b..85348ce 100644 --- a/package.lisp +++ b/package.lisp @@ -21,6 +21,14 @@ :block/rm :block/stat + ;; / bootstrap calls + :bootstrap + :bootstrap/list + :bootstrap/add + :bootstrap/add/default + :bootstrap/rm + :bootstrap/rm/all + ;; / config calls :config :config/show