chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: chicken and socks5


From: Christian Kellermann
Subject: Re: chicken and socks5
Date: Fri, 26 Feb 2021 11:42:23 +0100

* Александр <steeel@yandex.ru> [210121 15:33]:
>    Is there any egg which provides socks5 for chicken?

I have written a minimal binding to get a Tor socket with chicken,
as part of a gopher client. You can grab it from here:

$ git clone git://vernunftzentrum.de/holymoly.git

The interesting file in there is the proxy.scm file.  This relies
on the bitstring egg being installed so you might want to do this
first.

I am choosing a proxy here:

(define proxy
  (and-let*
        ((proxy-vals (or (get-environment-variable "SOCKS_PROXY")
                         "localhost:9050"))
         (conf
          (if (not (string-null? proxy-vals))
             (string-split proxy-vals ":")
             #f)) ;; no proxy configured, so abort here
         (proxy-host (car conf))
         (proxy-port (string->number (cadr conf))))
    (make-parameter (cons proxy-host proxy-port))))

and further on I use this in:

(let-values (((i o _) (if proxy
                               (connect/socksv5 (car (proxy)) (cdr (proxy)) 
server port)
                               (receive (i o) (tcp-connect server port) (values 
i o #f)))))
.....

There is virtually no error handling happening and other control
mechanisms are missing. I am showing this in the hope that it may
be helpful.

All the best,

Christian


-- 
May you be peaceful, may you live in safety, may you be free from
suffering, and may you live with ease. Also encrypt mails to me:
gpg key 0x068757350D0328634B833B65C537678F6BC627B5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]