Skip to content
Diode client written in GO that run blockquick algorithm and socks server to transmit data through diodechain.
Go C C++ Assembly Java Python Other
Branch: master
Clone or download
Latest commit 2d922d2 Jan 21, 2020


Diode go client

This is Go client for connecting device through diodechain. You can found more detail about how diodechain/client works in our previous presentations

Build Status



Setup go environment


Before install golang, please ensure your device meets the requirements (

You can download the latest binary distribution or install from the source code Here we are going to install golang with Homebrew.

Install Homebrew

$ /usr/bin/ruby -e "$(curl -fsSL"

Install Go

$ brew install golang

Then you can check go version meets the requirement (>1.10).

$ go version

Install dependencies

$ go mod download

Run test

$ go test `go list ./... | grep -v gowasm_test` // ignore gowasm_test folder


$ make test


$ go build


$ make build


Command line options

  diode - Diode network command line interfaces
  diode [OPTIONS] COMMAND [ARG...]
  -blacklists string
    	addresses are not allowed to connect to published resource (worked when whitelists is empty)
  -dbpath string
    	file path to db file (default "./db/private.db")
    	turn on debug mode
  -diodeaddrs string
    	addresses of Diode node server (default ",,")
  -fleet string
    	fleet contract address (default "0x6000000000000000000000000000000000000000")
    	enable tcp keepalive (default true)
    	enable metrics stats
  -registry string
    	registry contract address (default "0x5000000000000000000000000000000000000000")
  -retrytimes int
    	retry times to connect the remote rpc server (default 3)
  -retrywait int
    	wait seconds before next retry (default 1)
  -rlimit_nofile int
    	specify the file descriptor numbers that can be opened by this process
    	skip host validation
  -timeout int
    	timeout seconds to connect to the remote rpc server (default 5)
  -whitelists string
    	addresses are allowed to connect to published resource (worked when whitelists is empty)
    This command enables a socks proxy on the local host for use with Browsers (Firefox), SSH, Java and other applications to communicate via the Diode Network.
      -socksd_host string
    	host of socks server listening to (default "")
      -socksd_port int
    	port of socks server listening to (default 1080)
      diode socksd -socksd_port 8082 -socksd_host
    This command enables a public http server as is used by the "" website
    	allow redirect all http transmission to httpsd
      -certpath string
    	Pem format of certificate file path of httpsd secure server (default "./priv/cert.pem")
      -httpd_host string
    	host of httpd server listening to (default "")
      -httpd_port int
    	port of httpd server listening to (default 80)
      -httpsd_host string
    	host of httpsd server listening to (default "")
      -httpsd_port int
    	port of httpsd server listening to (default 443)
      -privpath string
    	Pem format of private key file path of httpsd secure server (default "./priv/priv.pem")
      -proxy_host string
    	host of socksd proxy server (default "")
      -proxy_port int
    	port of socksd proxy server (default 1080)
    	enable httpsd server
    	enable socksd proxy server
      diode httpd -httpd_port 8080 -httpsd_port 443 -secure -certpath ./cert.pem -privpath ./priv.pem
    This command publishes ports of the local device to the Diode Network.
      diode publish

Tunnel to ssh using your diode socks proxy

$ diode_go_client -runsocks=true
$ ssh pi@<ADDRESS>.diode -o 'ProxyCommand=nc -X 5 -x localhost:1080 %h %p'

Streaming video through websocket

  • Start socks with websocket server
$ go run main.go
  • Start raspivid or any other stream service
// profile must be baseline
$ raspivid -n -w 320 -h 180 -t 0 -l -o tcp:// -fps 12 -pf baseline

Then you can see streaming video through web/mplayer.

  • Through mplayer

    $ curl --socks5-hostname localhost:8080 <DIODE ADDRESS>.diode:9090 -o- | mplayer - -cache 1000
  • Through examples/web

    $ npm run dev
  • Enable proxy settings in browser


    1. Open Preferences in menu or type about:preferences in search bar.
    2. Goto Network Settings and click Settings button.
    3. Setup Automatic proxy configuration URL to the porxy.pac, eg: file:///Users/Guest/diode_go_client/proxy.pac
    4. Click reload then you can proxy request from *.diode * to the go client.
  • Type the website URL and see <MODE>.<DIODE ADDRESS>.diode:8082.


    1. r: read
    2. w: write
    3. s: share
You can’t perform that action at this time.