mysteriumnetwork / node

Mysterium Network Node - official implementation of distributed VPN network (dVPN) protocol
https://mysterium.network
GNU General Public License v3.0
1.11k stars 311 forks source link

Decrease binary size #449

Closed vkuznecovas closed 3 years ago

vkuznecovas commented 6 years ago

consider using https://upx.github.io/ (or something else) for binary compression

soffokl commented 5 years ago

https://github.com/jondot/goweight is a great tool that can help to analyze sizes.

soffokl@MBP-Dmitry:~/go/src/github.com/mysteriumnetwork/node/cmd/mysterium_node$ goweight
  4.3 MB github.com/mysteriumnetwork/node/core/location/gendb
  3.8 MB net/http
  3.3 MB runtime
  2.2 MB github.com/mysteriumnetwork/node/core/location
  1.8 MB net
  1.8 MB crypto/tls
  1.6 MB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb
  1.3 MB reflect
  1.3 MB github.com/mysteriumnetwork/node/vendor/github.com/cihub/seelog
  997 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/sys/unix
  959 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/metrics
  940 kB math/big
  925 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/payments/registry
  905 kB github.com/mysteriumnetwork/node/vendor/github.com/chzyer/readline
  836 kB crypto/x509
  820 kB encoding/gob
  813 kB syscall
  792 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/wireguard-go/device
  766 kB github.com/mysteriumnetwork/node/vendor/github.com/asdine/storm
  746 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/rpc
  714 kB github.com/mysteriumnetwork/node/vendor/github.com/urfave/cli
  699 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/trie
  679 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/language
  671 kB text/template
  664 kB github.com/mysteriumnetwork/node/vendor/github.com/huin/goupnp/dcps/internetgateway2
  660 kB encoding/xml
  649 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/net/html
  634 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/net/ipv4
  631 kB encoding/json
  622 kB go/ast
  596 kB github.com/mysteriumnetwork/node/vendor/go.etcd.io/bbolt
  576 kB github.com/mysteriumnetwork/node/vendor/github.com/nats-io/go-nats
  575 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/payments/contracts/abigen
  568 kB text/template/parse
  564 kB github.com/mysteriumnetwork/node/vendor/github.com/stretchr/testify/assert
  551 kB html/template
  526 kB github.com/mysteriumnetwork/node/vendor/github.com/rjeczalik/notify
  517 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/crypto/secp256k1
  516 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/core/types
  509 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/accounts/keystore
  472 kB github.com/mysteriumnetwork/node/cmd
  469 kB internal/x/text/unicode/norm
  468 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/net/ipv6
  456 kB github.com/mysteriumnetwork/node/vendor/github.com/huin/goupnp/dcps/internetgateway1
  452 kB time
  436 kB fmt
  430 kB go/parser
  423 kB regexp/syntax
  418 kB go/printer
  412 kB internal/x/net/dns/dnsmessage
  404 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/rlp
  401 kB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb/storage
  396 kB regexp
  392 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/net/websocket
  391 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/accounts/abi
  389 kB os
  388 kB testing
  387 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind
  364 kB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb/table
  351 kB github.com/mysteriumnetwork/node/tequilapi/endpoints
  346 kB compress/flate
  342 kB archive/zip
  341 kB runtime/pprof
  339 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/log
  334 kB github.com/mysteriumnetwork/node/services/openvpn
  331 kB github.com/mysteriumnetwork/node/communication/nats/discovery
  320 kB crypto/elliptic
  302 kB encoding/asn1
  298 kB github.com/mysteriumnetwork/node/vendor/github.com/oschwald/maxminddb-golang
  294 kB net/rpc
  279 kB internal/x/crypto/cryptobyte
  278 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/encoding/traditionalchinese
  266 kB strings
  263 kB strconv
  255 kB go/constant
  252 kB github.com/mysteriumnetwork/node/cmd/commands/cli
  249 kB internal/x/text/unicode/bidi
  247 kB github.com/mysteriumnetwork/node/vendor/github.com/davecgh/go-spew/spew
  242 kB os/exec
  240 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/ethclient
  229 kB unicode
  223 kB flag
  223 kB math
  215 kB github.com/mysteriumnetwork/node/communication/nats/dialog
  210 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/common
  210 kB internal/x/net/idna
  209 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/ethdb
  209 kB github.com/mysteriumnetwork/node/vendor/github.com/allegro/bigcache
  207 kB mime
  203 kB github.com/mysteriumnetwork/node/identity
  202 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/net/bpf
  199 kB github.com/mysteriumnetwork/node/vendor/github.com/huin/goupnp/soap
  199 kB bytes
  197 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/net/internal/socket
  197 kB github.com/mysteriumnetwork/node/tequilapi/client
  194 kB internal/poll
  188 kB github.com/mysteriumnetwork/node/vendor/github.com/deckarep/golang-set
  186 kB crypto/rsa
  185 kB github.com/mysteriumnetwork/node/vendor/github.com/asaskevich/EventBus
  185 kB net/http/httptest
  182 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/encoding/simplifiedchinese
  182 kB html
  179 kB internal/x/net/http2/hpack
  178 kB database/sql/driver
  178 kB encoding/binary
  177 kB bufio
  176 kB github.com/mysteriumnetwork/node/vendor/github.com/asdine/storm/q
  176 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/event
  176 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/encoding/japanese
  176 kB github.com/mysteriumnetwork/node/services/openvpn/service
  174 kB github.com/mysteriumnetwork/node/communication/nats
  174 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/params
  173 kB mime/multipart
  169 kB net/url
  166 kB net/textproto
  165 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/accounts
  164 kB internal/x/net/route
  161 kB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb/iterator
  156 kB github.com/mysteriumnetwork/node/session/promise
  156 kB github.com/mysteriumnetwork/node/identity/registry
  156 kB github.com/mysteriumnetwork/node/session
  154 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/encoding/charmap
  152 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/encoding/korean
  151 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/payments/promises
  150 kB github.com/mysteriumnetwork/node/core/connection
  148 kB github.com/mysteriumnetwork/node/market/mysterium
  146 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/p2p/nat
  144 kB github.com/mysteriumnetwork/node/vendor/github.com/pmezard/go-difflib/difflib
  144 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/go-openvpn/openvpn
  142 kB net/smtp
  141 kB github.com/mysteriumnetwork/node/tequilapi
  141 kB crypto/cipher
  140 kB github.com/mysteriumnetwork/node/core/service
  140 kB io
  135 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/go-openvpn/openvpn/config
  134 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/common/hexutil
  132 kB github.com/mysteriumnetwork/node/vendor/github.com/pborman/uuid
  130 kB github.com/mysteriumnetwork/node/vendor/github.com/huin/goupnp
  129 kB github.com/mysteriumnetwork/node/vendor/github.com/julienschmidt/httprouter
  128 kB github.com/mysteriumnetwork/node/vendor/github.com/gofrs/uuid
  127 kB github.com/mysteriumnetwork/node/nat
  125 kB github.com/mysteriumnetwork/node/session/payment
  124 kB sync
  123 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/go-openvpn/openvpn/management
  122 kB github.com/mysteriumnetwork/node/vendor/github.com/huin/goupnp/ssdp
  122 kB go/scanner
  121 kB sort
  121 kB github.com/mysteriumnetwork/node/vendor/github.com/asdine/storm/index
  120 kB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb/cache
  119 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/crypto/chacha20poly1305
  118 kB github.com/mysteriumnetwork/node/vendor/github.com/rs/cors
  113 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/p2p/netutil
  112 kB github.com/mysteriumnetwork/node/nat/traversal
  112 kB math/rand
  112 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/runes
  109 kB go/token
  107 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum
  105 kB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb/util
  105 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/encoding
  104 kB crypto/ecdsa
  104 kB crypto/aes
  103 kB github.com/mysteriumnetwork/node/vendor/github.com/oschwald/geoip2-golang
  102 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/transform
  102 kB internal/x/text/transform
  101 kB path/filepath
   98 kB context
   97 kB internal/x/crypto/chacha20poly1305
   95 kB github.com/mysteriumnetwork/node/vendor/github.com/huin/goupnp/httpu
   92 kB github.com/mysteriumnetwork/node/services/wireguard/endpoint/userspace
   91 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/crypto
   90 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/crypto/blake2s
   88 kB github.com/mysteriumnetwork/node/cmd/commands/service
   87 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/encoding/unicode
   83 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/wireguard-go/tun
   82 kB github.com/mysteriumnetwork/node/metadata
   82 kB github.com/mysteriumnetwork/node/core/ip
   81 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/encoding/htmlindex
   80 kB github.com/mysteriumnetwork/node/services/wireguard
   80 kB github.com/mysteriumnetwork/node/services/wireguard/endpoint
   79 kB crypto/sha512
   78 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/crypto/sha3
   77 kB encoding/base64
   77 kB github.com/mysteriumnetwork/node/metrics
   76 kB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb/journal
   75 kB compress/gzip
   75 kB hash/fnv
   75 kB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb/memdb
   74 kB crypto/x509/pkix
   74 kB internal/x/net/http/httpproxy
   73 kB github.com/mysteriumnetwork/node/market
   72 kB github.com/mysteriumnetwork/node/services/noop
   71 kB crypto/sha256
   71 kB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb/opt
   71 kB github.com/mysteriumnetwork/node/vendor/github.com/pkg/errors
   70 kB log/syslog
   70 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/net/html/charset
   69 kB github.com/mysteriumnetwork/node/vendor/github.com/go-stack/stack
   69 kB crypto/sha1
   68 kB io/ioutil
   68 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/go-openvpn/openvpn/middlewares/server/auth
   67 kB github.com/mysteriumnetwork/node/core/storage/boltdb
   65 kB github.com/mysteriumnetwork/node/consumer/statistics
   65 kB github.com/mysteriumnetwork/node/market/metrics/oracle
   65 kB github.com/mysteriumnetwork/node/services/wireguard/service
   65 kB github.com/mysteriumnetwork/node/utils
   64 kB github.com/mysteriumnetwork/node/services/wireguard/connection
   64 kB net/http/internal
   64 kB github.com/mysteriumnetwork/node/communication
   63 kB github.com/mysteriumnetwork/node/requests
   62 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/go-openvpn/openvpn/tls
   62 kB github.com/mysteriumnetwork/node/services/openvpn/session
   61 kB crypto/rand
   60 kB text/tabwriter
   60 kB github.com/mysteriumnetwork/node/market/proposals/registry
   60 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/net/html/atom
   60 kB net/http/httptrace
   58 kB hash/crc32
   58 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/common/math
   57 kB encoding/pem
   57 kB container/list
   56 kB github.com/mysteriumnetwork/node/vendor/github.com/golang/snappy
   56 kB log
   55 kB github.com/mysteriumnetwork/node/core/node
   54 kB github.com/mysteriumnetwork/node/cmd/commands/license
   53 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/crypto/internal/chacha20
   52 kB internal/fmtsort
   52 kB crypto/des
   51 kB github.com/mysteriumnetwork/node/blockchain
   49 kB github.com/mysteriumnetwork/node/core/storage/boltdb/migrations
   49 kB mime/quotedprintable
   48 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/payments/identity
   48 kB crypto/md5
   48 kB encoding/hex
   48 kB github.com/mysteriumnetwork/node/consumer/session
   47 kB github.com/mysteriumnetwork/node/services/openvpn/core
   47 kB github.com/mysteriumnetwork/node/vendor/github.com/huin/goupnp/scpd
   47 kB github.com/mysteriumnetwork/node/vendor/github.com/jackpal/go-nat-pmp
   47 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/sys/cpu
   46 kB github.com/mysteriumnetwork/node/vendor/github.com/asdine/storm/internal
   46 kB crypto/dsa
   46 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/common/mclock
   43 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/encoding/internal
   42 kB github.com/mysteriumnetwork/node/services/wireguard/resources
   42 kB os/signal
   42 kB internal/x/crypto/internal/chacha20
   42 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/wireguard-go/rwcancel
   40 kB internal/cpu
   40 kB github.com/mysteriumnetwork/node/session/payment/factory
   40 kB github.com/mysteriumnetwork/node/session/promise/issuers
   39 kB runtime/debug
   39 kB internal/x/text/secure/bidirule
   39 kB github.com/mysteriumnetwork/node/session/balance
   39 kB math/bits
   38 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/encoding/internal/identifier
   38 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/wireguard-go/ratelimiter
   38 kB github.com/mysteriumnetwork/node/vendor/github.com/nats-io/go-nats/encoders/builtin
   37 kB runtime/cgo
   37 kB github.com/mysteriumnetwork/node/vendor/github.com/allegro/bigcache/queue
   36 kB github.com/mysteriumnetwork/node/vendor/github.com/ethereum/go-ethereum/common/prque
   36 kB go/format
   34 kB github.com/mysteriumnetwork/node/tequilapi/utils
   34 kB path
   32 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/crypto/curve25519
   31 kB internal/x/crypto/curve25519
   31 kB runtime/trace
   31 kB github.com/mysteriumnetwork/node/services/openvpn/discovery/dto
   30 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/crypto/scrypt
   30 kB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb/filter
   30 kB github.com/mysteriumnetwork/node/datasize
   30 kB internal/x/net/http/httpguts
   29 kB github.com/mysteriumnetwork/node/identity/selector
   29 kB github.com/mysteriumnetwork/node/core/storage/boltdb/migrations/history
   28 kB github.com/mysteriumnetwork/node/logconfig
   28 kB github.com/mysteriumnetwork/node/nat/mapping
   28 kB github.com/mysteriumnetwork/node/vendor/github.com/nats-io/go-nats/util
   27 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/net/internal/iana
   27 kB unicode/utf8
   26 kB github.com/mysteriumnetwork/node/vendor/github.com/nats-io/nuid
   26 kB internal/singleflight
   26 kB crypto
   24 kB github.com/mysteriumnetwork/node/vendor/github.com/jackpal/gateway
   24 kB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb/comparer
   24 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/go-openvpn/openvpn/middlewares/state
   22 kB github.com/mysteriumnetwork/node/session/promise/validators
   22 kB github.com/mysteriumnetwork/node/tequilapi/validation
   21 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/go-openvpn/openvpn/tunnel
   21 kB github.com/mysteriumnetwork/node/cmd/commands/daemon
   20 kB github.com/mysteriumnetwork/node/vendor/github.com/syndtr/goleveldb/leveldb/errors
   20 kB github.com/mysteriumnetwork/node/vendor/github.com/mitchellh/go-homedir
   19 kB sync/atomic
   19 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/go-openvpn/openvpn/middlewares/client/bytescount
   19 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/go-openvpn/openvpn/middlewares/client/auth
   18 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/crypto/poly1305
   18 kB internal/x/crypto/poly1305
   17 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/internal/tag
   17 kB crypto/rc4
   16 kB github.com/mysteriumnetwork/node/cmd/commands/version
   15 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/wireguard-go/xchacha20poly1305
   15 kB github.com/mysteriumnetwork/node/market/metrics
   15 kB hash
   15 kB internal/bytealg
   15 kB container/heap
   14 kB crypto/hmac
   14 kB internal/testlog
   14 kB internal/x/crypto/hkdf
   13 kB github.com/mysteriumnetwork/node/vendor/github.com/asdine/storm/codec/json
   12 kB runtime/internal/atomic
   12 kB github.com/mysteriumnetwork/node/services/wireguard/key
   11 kB runtime/internal/sys
   11 kB github.com/mysteriumnetwork/node/money
   10 kB github.com/mysteriumnetwork/node/firewall
   10 kB github.com/mysteriumnetwork/node/services/openvpn/discovery
  9.1 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/wireguard-go/tai64n
  8.6 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/crypto/pbkdf2
  8.5 kB github.com/mysteriumnetwork/node/vendor/github.com/mysteriumnetwork/wireguard-go/replay
  8.0 kB unicode/utf16
  7.7 kB crypto/internal/randutil
  7.2 kB internal/syscall/unix
  7.1 kB github.com/mysteriumnetwork/node/consumer
  6.8 kB encoding
  6.7 kB github.com/mysteriumnetwork/node/services/openvpn/middlewares/client/bytescount
  6.7 kB github.com/mysteriumnetwork/node/nat/traversal/config
  6.2 kB crypto/subtle
  6.0 kB internal/x/crypto/cryptobyte/asn1
  5.9 kB github.com/mysteriumnetwork/node/session/payment/noop
  5.8 kB github.com/mysteriumnetwork/node/vendor/github.com/asdine/storm/codec
  4.8 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/text/internal/utf8internal
  4.2 kB errors
  4.2 kB internal/nettrace
  3.6 kB internal/race
  3.4 kB github.com/mysteriumnetwork/node/vendor/github.com/aristanetworks/goarista/monotime
  3.3 kB github.com/mysteriumnetwork/node/vendor/golang.org/x/crypto/internal/subtle
  3.1 kB crypto/internal/subtle
  1.6 kB runtime/internal/math
chompomonim commented 3 years ago

@vkuznecovas @soffokl is this still relevant?

soffokl commented 3 years ago

Yes, this task is still in a nice to have state, it's not critical though.

chompomonim commented 3 years ago

Closing. We already did some efforts to decrease binary size. If we'll see possibility of more improvements, we'll create separate issue for that.