binfile

command module
v0.0.0-...-b0ebf76 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: MIT Imports: 10 Imported by: 0

README

Binfiles

  • TOC {:toc}

Known binfiles servers

Generic binfiles servers support arbitrary sizes via something like /1mb or /10gb.

Europe
Country Provider ASN Protocol XS S M L XL Generic
NL BBned AS15670 HTTP 32 MB 100 MB 1000 MB
NL BIT AS12859 FTP 10 MB 100 MB 500 MB
NL BIT AS12859 HTTP 10 MB 100 MB 500 MB
NL KPN AS1136 FTP 1 MB 8 MB 128 MB 512 MB
NL KPN AS1136 HTTP 1 MB 8 MB 128 MB
NL Luna.nl AS12902 HTTP 1 MB 10 MB 100 MB 1000 MB
NL NXS AS15879 HTTP 100 MB 1000 MB
NL ProServe AS21155 HTTP 10 MB 100 MB 1000 MB
NL Tele2 AS1257 FTP 1 MB 10 MB 100 MB 1024 MB
NL Tele2 AS1257 HTTP 1 MB 10 MB 100 MB 1024 MB
NL Tiscali AS5615 FTP 1 MB 10 MB 100 MB 1000 MB
NL TweakDSL AS25596 FTP 10 MB 100 MB
NL WideXS AS12573 FTP 1 MB 10 MB 100 MB 1000 MB
NL WideXS AS12573 HTTP 1 MB 10 MB 100 MB 1000 MB
NL XS4All AS3265 FTP 10 MB 100 MB
NL XS4All AS3265 HTTP 10 MB 100 MB 2000 MB
North America
Country Provider ASN Protocol XS S M L XL Generic
US mrow.org AS54858 HTTP/HTTPS 1 MB 32 MB 100 MB 500 MB 1 GB

Sample simple server instead of using actual files

This simple server will return a "file" based on the size requested:

  • /#size# will return file of that size e.g. /100mb made up entirely of 0xAA
  • /rand/#size# will return a pseudo random file (a repeated 9000 byte random chunk) of that size e.g. /rand/100mb
Sample run of the simple server

Run the server like so (with go installed):

go get github.com/n6udp/binfile
go run github.com/n6udp/binfile

A simple binfile -h will give you help but the most common argument to change is the default http bind of via binfile -httpbindaddr "0.0.0.0:80" or similar.

You can then use curl to ask for "files" of arbitrary size:

lburton@newquark ~ % curl -s localhost:8080/rand/100b | wc -c
100
lburton@newquark ~ % curl -s localhost:8080/rand/1gb | wc -c
1073741824
lburton@newquark ~ % time curl -s localhost:8080/rand/1gb | wc -c
1073741824
curl -s localhost:8080/rand/1gb  0.16s user 0.69s system 85% cpu 1.003 total
wc -c  0.10s user 0.64s system 73% cpu 1.002 total
lburton@newquark ~ % time curl -s localhost:8080/1gb | wc -c
1073741824
curl -s localhost:8080/1gb  0.14s user 0.73s system 83% cpu 1.045 total
wc -c  0.05s user 0.73s system 74% cpu 1.045 total
lburton@newquark ~ % curl -s localhost:8080/rand/100b  | hexdump
0000000 b0a6 bfe7 aa69 e109 1981 7e6f 2742 e0a0
0000010 0d68 f8df 5e42 87b2 6402 14f8 9cf1 1514
0000020 c857 3d7b b5c8 3c58 8c46 e3de f364 b191
0000030 7a03 b2a5 84e9 e7d2 9943 01b0 19e7 74f4
0000040 a971 1046 bb2b 0099 5bce aeea 8b56 b428
0000050 39dc 69b6 f79f 7e73 dc14 8266 5486 d2d1
0000060 630c 6e4a
0000064
lburton@newquark ~ % curl -s localhost:8080/100b  | hexdump
0000000 aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa
*
0000064
TLS support

We strongly recommend also offering http for the purposes of lower overhead but the sample server does support tls.

You can supply a hostname and set of bind addresses to have the server attempt to get a tls cert from letsencrypt like so:

binfile -httpbindaddr "0.0.0.0:80" -httpsbindaddr "0.0.0.0:443" -httpshostname "my.example.com"
Docker

There is a very simple Dockerfile that just exposes the http port (it assumes you will provide https on your own if you desire it)

docker run binfiles/binfile
Sample SystemD unit file

Place binfile itself at /usr/local/bin/binfile

Place binfile.service at /etc/systemd/system/binfile.service and then run:

systemctl enable binfile
systemctl start binfile

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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