go/

directory
v2.167.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2020 License: Apache-2.0, MIT

README

Berty go/

go.dev reference Code coverage

Please, read the main README.md file first.

This folder contains most of the go code needed by the project.

Download

Main binary: go get -u berty.tech/berty/v2/go/cmd/berty

Fetch library to your go cache: go get -u berty.tech/berty/v2

Main components

  • ./cmd/...: binaries / entrypoints
    • go get -v berty.tech/berty/v2/go/cmd/berty
  • ./pkg/...: packages especially made to be imported by other projects
  • ./internal/: internal packages that can be useful to understand how things are working under the hood
    • you won't be able to import them directly from your projects; if you think that an internal package should be made public, open an issue
  • ./framework: bridges used by mobile apps

Usage

Daemon
foo@bar:~$ berty daemon
...

Now you can interact with the daemon API.

Mini

TODO

Share Invite
foo@bar:~$ berty share-invite
█████████████████████████████████████████████████
█████████████████████████████████████████████████
████ ▄▄▄▄▄ ██████▄▀▀▀  ▀▀   ▀█▄ ▀ ▄▀▀█ ▄▄▄▄▄ ████
████ █   █ █▄ ▀     ▀█▀███ ▀▄█▀█▀███ █ █   █ ████
████ █▄▄▄█ ███  ▀▀▄▀ ▄▄ ▀  ▀█▀  █▀█ ██ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ ▀ █▄▀▄▀▄▀ ▀ ▀▄▀ ▀▄▀ ▀ █▄█▄▄▄▄▄▄▄████
████  ▄▀ ▄▄▄ ██▀▄ █▀▀▄█▀ ██▀▀▀▀█ ▀▀█   ▀█▀▄█▀████
████▀ ▀▄▀█▄ █▄▀█▄▀ █▀ ▀▀   ▀▀  ██ ███▀██▄██  ████
████▄▀▀▄▀▄▄█▄▄   ▀   ▀▄▄  ▄▄     ███▀ ▄ █ ██▀████
████  █  ▄▄▄▄ ▀▄  ▄▄  ▀▀ ▀▀▀█▀█▀▀▀▄▀ ▄▀▀▄▄▄▄▄████
████▀█ ▀▀▀▄▄▀█   ▄   █▀▀  ██ ▄██  ▀  ▀ ████  ████
██████ ▄  ▄▄   ▀▄▄██▄▄██  ██▄▀▄▀▀ █▀▀█   █▄▄ ████
████ ▄ █▄▄▄▀██  █▀█▀███▄ ▄█▄  ▀█   ▄    █ ▀▀▀████
████▀▀▄▄ ▀▄▀▄▀█▀█▀ ▀█▀▄▀▀ ▀▀▄  ▀ ▀██▄█ ██▄▄  ████
████▄  ▄█ ▄█▀▄█▀▀ ███ █  █▀ ▀▀█ ▀ ███  ██▀ ▀▄████
████▄██   ▄██ █▀▀▀ █▀▀ █▀ █▀  ██▀ █▀█▀█▄▀ ▄▄▄████
█████▀▀ ▀█▄█ █▀  █ ▀ ▀ ▄█ █▀▀▄▄▀ ▄  ▀▄▄██ ▀▀▀████
████▄▀ ▀ █▄▄▀▀ ▄ ▀▄▄  ▄▀▀▀▀█▀▀███▀ ▀ █▀▀███▄▄████
████▄█▄██▄▄▄▀▀ ▄ ██▄█▄▀▀ ▀█▀▀███▀▀██ ▄▄▄ ▀ ▄ ████
████ ▄▄▄▄▄ █  ▄█▀▄██▀▄██▀▀ █▀▀▀█▄  ▄ █▄█ ▀█▄▄████
████ █   █ █▄█ ▀███▀████ ▄██ █▀▄█ ██▄▄▄  █▀▄ ████
████ █▄▄▄█ █  ▄▀█▀ ▀█▀▄▀▀▀▀█▀▀ ▀█ █  ▀██ █▄ ▄████
████▄▄▄▄▄▄▄█▄███▄▄███▄█▄▄██▄▄▄██▄██▄▄▄█▄███▄▄████
█████████████████████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
html url: https://berty.tech/id#key=CiAXtiFJwUkmdTcLIgTZmQlEoUMGONLMKgXbxw72OWPb1hIgmXEyKjqiJLbf08ChSdRlry6F63a3LeDsc8v-_gXadLk&name=demo
Info
foo@bar:~$ berty info
{
  "protocol": {
    "process": {
      "rlimitCur": "1024",
      "numGoroutine": "473",
      "nofile": "41",
      "startedAt": "1600443153",
      "numCpu": "12",
      "goVersion": "go1.15.2",
      "operatingSystem": "linux",
      "hostName": "REDACTED",
      "arch": "amd64",
      "version": "v2.149.0-3-g8b6591d7",
      "vcsRef": "8b6591d7",
      "selfRusage": "{\"Utime\":{\"Sec\":1,\"Usec\":268952},\"Stime\":{\"Sec\":0,\"Usec\":254625},\"Maxrss\":77740,\"Ixrss\":0,\"Idrss\":0,\"Isrss\":0,\"Minflt\":8498,\"Majflt\":0,\"Nswap\":0,\"Inblock\":0,\"Oublock\":0,\"Msgsnd\":0,\"Msgrcv\":0,\"Nsignals\":0,\"Nvcsw\":9241,\"Nivcsw\":65}",
      "childrenRusage": "{\"Utime\":{\"Sec\":1,\"Usec\":610485},\"Stime\":{\"Sec\":0,\"Usec\":295980},\"Maxrss\":33524,\"Ixrss\":0,\"Idrss\":0,\"Isrss\":0,\"Minflt\":10260,\"Majflt\":0,\"Nswap\":0,\"Inblock\":0,\"Oublock\":0,\"Msgsnd\":0,\"Msgrcv\":0,\"Nsignals\":0,\"Nvcsw\":12825,\"Nivcsw\":597}",
      "rlimitMax": "1048576",
      "pid": "3730",
      "ppid": "3729",
      "priority": "20",
      "uid": "1000",
      "workingDir": "REDACTED"
    },
    "p2p": {
      "connectedPeers": "10"
    },
    "orbitdb": {
      "accountMetadata": {
        "progress": "2",
        "maximum": "2"
      }
    }
  },
  "messenger": {
    "protocolInSameProcess": true,
    "db": {
      "accounts": "1"
    }
  }
}
--help
foo@bar:~$ berty -h
USAGE
  berty [global flags] <subcommand> [flags] [args...]

SUBCOMMANDS
  daemon        start a full Berty instance (Berty Protocol + Berty Messenger)
  mini          start a terminal-based mini berty client (not fully compatible with the app)
  banner        print the Berty banner of the day
  version       print software version
  info          display system info
  groupinit     initialize a new multi-member group
  share-invite  share invite link on your terminal or in the dev channel on Discord
  token-server  token server, a basic token server issuer without auth or logging
  repl-server   replication server

FLAGS
  -log.file ...                             if specified, will log everything in JSON into a file and nothing on stderr
  -log.filters info+:bty*,-*.grpc error+:*  zapfilter configuration
  -log.format color                         can be: json, console, color, light-console, light-color
  -log.tracer ...                           specify "stdout" to output tracing on stdout or <hostname:port> to trace on jaeger

foo@bar:~$ berty daemon -h
USAGE
  berty [global flags] daemon [flags]

FLAGS
  -node.display-name moul (cli)                                   display name
  -node.listeners /ip4/127.0.0.1/tcp/9091/grpc                    gRPC API listeners
  -node.no-notif false                                            disable desktop notifications
  -node.rebuild-db false                                          reconstruct messenger DB from OrbitDB logs
  -p2p.ipfs-announce ...                                          IPFS announce addrs
  -p2p.ipfs-api-listeners ...                                     IPFS API listeners
  -p2p.ipfs-listeners /ip4/0.0.0.0/tcp/0,/ip4/0.0.0.0/udp/0/quic  IPFS listeners
  -p2p.ipfs-no-announce ...                                       IPFS exclude announce addrs
  -p2p.local-discovery true                                       local discovery
  -p2p.max-backoff 1m0s                                           maximum p2p backoff duration
  -p2p.min-backoff 1s                                             minimum p2p backoff duration
  -p2p.rdvp []                                                    list of rendezvous point maddr, ":dev:" will add the default devs servers, ":none:" will disable rdvp
  -p2p.webui-listener :3999                                       IPFS WebUI listener
  -store.dir /home/moul/.config/berty-tech/berty                  root datastore directory
  -store.inmem false                                              disable datastore persistence

foo@bar:~$ berty mini -h
USAGE
  berty [global flags] mini [flags]

FLAGS
  -mini.group ...                                                 group to join, leave empty to create a new group
  -node.display-name moul (cli)                                   display name
  -node.listeners ...                                             gRPC API listeners
  -node.no-notif false                                            disable desktop notifications
  -node.rebuild-db false                                          reconstruct messenger DB from OrbitDB logs
  -node.remote-addr ...                                           remote Berty gRPC API address
  -p2p.ipfs-announce ...                                          IPFS announce addrs
  -p2p.ipfs-api-listeners ...                                     IPFS API listeners
  -p2p.ipfs-listeners /ip4/0.0.0.0/tcp/0,/ip4/0.0.0.0/udp/0/quic  IPFS listeners
  -p2p.ipfs-no-announce ...                                       IPFS exclude announce addrs
  -p2p.local-discovery true                                       local discovery
  -p2p.max-backoff 1m0s                                           maximum p2p backoff duration
  -p2p.min-backoff 1s                                             minimum p2p backoff duration
  -p2p.rdvp []                                                    list of rendezvous point maddr, ":dev:" will add the default devs servers, ":none:" will disable rdvp
  -p2p.webui-listener ...                                         IPFS WebUI listener
  -store.dir /home/moul/.config/berty-tech/berty                  root datastore directory
  -store.inmem false                                              disable datastore persistence

foo@bar:~$ berty banner -h
USAGE
  berty banner [flags]

FLAGS
  -light false   light mode
  -random false  pick a random quote

foo@bar:~$ berty version -h
USAGE
  berty version

foo@bar:~$ berty info -h
USAGE
  berty [global flags] info [flags]

FLAGS
  -info.anonimize false                                           anonimize output for sharing
  -info.refresh 0s                                                refresh every DURATION (0: no refresh)
  -node.display-name moul (cli)                                   display name
  -node.no-notif false                                            disable desktop notifications
  -node.rebuild-db false                                          reconstruct messenger DB from OrbitDB logs
  -node.remote-addr ...                                           remote Berty gRPC API address
  -p2p.ipfs-announce ...                                          IPFS announce addrs
  -p2p.ipfs-api-listeners ...                                     IPFS API listeners
  -p2p.ipfs-listeners /ip4/0.0.0.0/tcp/0,/ip4/0.0.0.0/udp/0/quic  IPFS listeners
  -p2p.ipfs-no-announce ...                                       IPFS exclude announce addrs
  -p2p.local-discovery true                                       local discovery
  -p2p.max-backoff 1m0s                                           maximum p2p backoff duration
  -p2p.min-backoff 1s                                             minimum p2p backoff duration
  -p2p.rdvp []                                                    list of rendezvous point maddr, ":dev:" will add the default devs servers, ":none:" will disable rdvp
  -store.dir /home/moul/.config/berty-tech/berty                  root datastore directory
  -store.inmem false                                              disable datastore persistence

foo@bar:~$ berty groupinit -h
USAGE
  berty groupinit

foo@bar:~$ berty share-invite -h
USAGE
  berty [global flags] share-invite [flags]

FLAGS
  -dev-channel false                                              post qrcode on dev channel
  -no-term false                                                  do not print the QR code in terminal
  -node.display-name moul (cli)                                   display name
  -node.no-notif false                                            disable desktop notifications
  -node.rebuild-db false                                          reconstruct messenger DB from OrbitDB logs
  -node.remote-addr ...                                           remote Berty gRPC API address
  -p2p.ipfs-announce ...                                          IPFS announce addrs
  -p2p.ipfs-api-listeners ...                                     IPFS API listeners
  -p2p.ipfs-listeners /ip4/0.0.0.0/tcp/0,/ip4/0.0.0.0/udp/0/quic  IPFS listeners
  -p2p.ipfs-no-announce ...                                       IPFS exclude announce addrs
  -p2p.local-discovery true                                       local discovery
  -p2p.max-backoff 1m0s                                           maximum p2p backoff duration
  -p2p.min-backoff 1s                                             minimum p2p backoff duration
  -p2p.rdvp []                                                    list of rendezvous point maddr, ":dev:" will add the default devs servers, ":none:" will disable rdvp
  -store.dir /home/moul/.config/berty-tech/berty                  root datastore directory
  -store.inmem false                                              disable datastore persistence

foo@bar:~$ berty token-server -h
USAGE
  berty [global flags] token-server [flags]

FLAGS
  -l 8080      http listener
  -s ...       comma separated list of supported services as name@ip:port
  -secret ...  base64 encoded secret
  -sk ...      base64 encoded signature key

foo@bar:~$ berty repl-server -h
USAGE
  berty [global flags] repl-server [flags]

FLAGS
  -p2p.ipfs-announce ...                                          IPFS announce addrs
  -p2p.ipfs-api-listeners ...                                     IPFS API listeners
  -p2p.ipfs-listeners /ip4/0.0.0.0/tcp/0,/ip4/0.0.0.0/udp/0/quic  IPFS listeners
  -p2p.ipfs-no-announce ...                                       IPFS exclude announce addrs
  -p2p.local-discovery true                                       local discovery
  -p2p.max-backoff 1m0s                                           maximum p2p backoff duration
  -p2p.min-backoff 1s                                             minimum p2p backoff duration
  -p2p.rdvp []                                                    list of rendezvous point maddr, ":dev:" will add the default devs servers, ":none:" will disable rdvp
  -store.dir /home/moul/.config/berty-tech/berty                  root datastore directory
  -store.inmem false                                              disable datastore persistence

Other Binaries

rdvp
foo@bar:~$ rdvp -h
USAGE
  rdvp [global flags] <subcommand>

SUBCOMMANDS
  serve   
  genkey  

FLAGS
  -logfile stderr                           if specified, will log everything in JSON into a file and nothing on stderr
  -logfilters info,warn:bty,bty.* error+:*  logged namespaces
  -logformat color                          if specified, will override default log format

foo@bar:~$ rdvp serve -h
USAGE
  rdvp [global flags] serve [flags]

EXAMPLE
  rdvp genkey > rdvp.key
  rdvp serve -pk `cat rdvp.key` -db ./rdvp-store

FLAGS
  -db :memory:                                         rdvp sqlite URN
  -l /ip4/0.0.0.0/tcp/4040,/ip4/0.0.0.0/udp/4141/quic  lists of listeners of (m)addrs separate by a comma
  -pk ...                                              private key (generated by `rdvp genkey`)

foo@bar:~$ rdvp genkey -h
USAGE
  genkey

FLAGS
  -length 2048   The length (in bits) of the key generated.
  -type Ed25519  Type of the private key generated, one of : Ed25519, ECDSA, Secp256k1, RSA
betabot
foo@bar:~$ betabot -h
Usage of betabot:
  -addr string
    	remote 'berty daemon' address (default "127.0.0.1:9091")
  -display-name string
    	bot's display name (default "moul (bot)")

Directories

Path Synopsis
cmd
berty
Berty is the main CLI entrypoint to manage the Berty ecosystem (client, server, relay, dev).
Berty is the main CLI entrypoint to manage the Berty ecosystem (client, server, relay, dev).
berty/mini
Package mini contains main helpers to start a term-based Berty mini client.
Package mini contains main helpers to start a term-based Berty mini client.
rdvp
rdvp is a service to hold Berty's rendezvous point for faster peer discovery.
rdvp is a service to hold Berty's rendezvous point for faster peer discovery.
framework
bertybridge
Package bertybridge is the main gomobile entrypoint, used to generate iOS and Android frameworks.
Package bertybridge is the main gomobile entrypoint, used to generate iOS and Android frameworks.
internal
cryptoutil
Package cryptoutil contains generic & stateless crypto helpers.
Package cryptoutil contains generic & stateless crypto helpers.
discordlog
discordlog is an unsafe package used during development to log info directly on the Berty's Discord server.
discordlog is an unsafe package used during development to log info directly on the Berty's Discord server.
grpcutil
Package grpcutil contains gRPC lazy codecs, messages and a buf-based listener.
Package grpcutil contains gRPC lazy codecs, messages and a buf-based listener.
handshake
Package handshake implements a capability-based handshake.
Package handshake implements a capability-based handshake.
ipfsutil
Package ipfsutil contains helpers around IPFS (logging, datastore, networking, core API, ...).
Package ipfsutil contains helpers around IPFS (logging, datastore, networking, core API, ...).
testutil
Package testutil contains testing helpers (logging, slow skipping).
Package testutil contains testing helpers (logging, slow skipping).
tinder
Package tinder is a multi-driver service backed by a cache.
Package tinder is a multi-driver service backed by a cache.
tools
Package tools ensures that `go mod` detect some required dependencies.
Package tools ensures that `go mod` detect some required dependencies.
pkg
banner
Package banner generates ASCII picture of the Berty logo with a message.
Package banner generates ASCII picture of the Berty logo with a message.
bertymessenger
Package bertymessenger is a reverse proxy.
Package bertymessenger is a reverse proxy.
bertyprotocol
Package bertyprotocol is a reverse proxy.
Package bertyprotocol is a reverse proxy.
bertytypes
This package is generated with Protobuf.
This package is generated with Protobuf.
errcode
Package errcode contains the list of Berty error codes.
Package errcode contains the list of Berty error codes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL