54 lines
1.8 KiB
Plaintext
54 lines
1.8 KiB
Plaintext
#!@GUILE@ \
|
|
-e (@\ (gnunet-identity)\ main) -L . -s
|
|
!#
|
|
;;;; Copyright © 2015 Rémi Delrue <asgeir@free.fr>
|
|
;;;;
|
|
;;;; This program is free software: you can redistribute it and/or modify
|
|
;;;; it under the terms of the GNU General Public License as published by
|
|
;;;; the Free Software Foundation, either version 3 of the License, or
|
|
;;;; (at your option) any later version.
|
|
;;;;
|
|
;;;; This program is distributed in the hope that it will be useful,
|
|
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;;;; GNU General Public License for more details.
|
|
;;;;
|
|
;;;; You should have received a copy of the GNU General Public License
|
|
;;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
(define-module (gnunet-identity)
|
|
#:use-module (ice-9 match)
|
|
#:use-module (system foreign)
|
|
#:use-module (gnu gnunet common)
|
|
#:use-module (gnu gnunet configuration)
|
|
#:use-module (gnu gnunet scheduler)
|
|
#:use-module (gnu gnunet identity)
|
|
#:export (main))
|
|
|
|
(define *config* #f) ; configuration handle
|
|
(define *handle* #f) ; identity handle
|
|
(define *kill-task* #f)
|
|
|
|
(define (shutdown-task _)
|
|
(when *handle* (close-identity-service *handle*)))
|
|
|
|
(define (print-ego ego name)
|
|
(cond ((and ego name)
|
|
(let ((key (ego-public-key ego)))
|
|
(simple-format #t "~a - ~a\n" name (ecdsa-public-key->string key))))
|
|
((not ego)
|
|
(cancel-task! *kill-task*)
|
|
(add-task! shutdown-task))))
|
|
|
|
(define (first-task _)
|
|
(set! *handle* (open-identity-service *config* print-ego))
|
|
(set! *kill-task* (add-task! shutdown-task #:delay (time-rel #:seconds 5))))
|
|
|
|
(define (main args)
|
|
(set! *config* (load-configuration "~/.gnunet/gnunet.conf"))
|
|
(call-with-scheduler *config* first-task))
|
|
|
|
;; Local Variables:
|
|
;; mode: scheme
|
|
;; End:
|