Next: , Up: Netlayers   [Contents][Index]


7.5.1 Tor Onion Services

Assuming a Tor daemon is running, a Goblins Onion netlayer can be created by spawning the ^onion-netlayer object from the (goblins ocapn netlayer onion) module:

> (define onion-netlayer
    (spawn ^onion-netlayer))

That netlayer can then be used to spawn an OCapN router actor:

> (define mycapn (spawn-mycapn onion-netlayer))

Each the ^onion-netlayer is spawned it generates a new private-key and service-id. If you wish for these to persist, they need to be stored (securely, as anyone with them has the capability to host at them). This can be done by using Goblins’ persistence system, an example of this is:

> (define-values (ocapn-vat onion-netlayer onion-mycapn)
    (spawn-persistent-vat
     (make-persistence-env #:extends (list onion-netlayer-env captp-env))
     (lambda ()
       (define netlyaer
         (spawn ^onion-netlayer))
       (values netlayer
               (spawn-mycapn netlayer)))
     (make-syrup-store "ocapn.syrup")))