HN Gopher Feed (2017-08-02) - page 1 of 10 ___________________________________________________________________
Show HN: Bt - BitTorrent library in Java 8
155 points by atomashpolskiy
https://github.com/atomashpolskiy/bt/blob/master/README.md#----bt___________________________________________________________________
zitterbewegung - 6 hours ago
It looks great but the top GIF makes it seem like you are offering
a command line BT client. If I were you I would have it slowly
scroll through the code of the client in the GIF or put a few
frames of code of the client and or some compiling and then show
the current top GIF.
atomashpolskiy - 6 hours ago
Oh, I didn't expect this :) Sounds good, but I'm not sure I have
patience do this right, it's such a pain to record gifs - I
always misspell or misclick something, and by take #47 go
completely nuts
deft - 4 hours ago
Try using asciinema. It records your terminal session and works
so well. Of course typos and such are still an issue...
zitterbewegung - 5 hours ago
How about put a picture of source code above it then?
[deleted]
amzans - 3 hours ago
It's great to see projects like this on HN. Congrats man, well
done!
yodsanklai - 1 hours ago
Nice work. I'm wondering, how would you test/benchmark such an
application. Besides manual testing on a variety of torrents, how
would you do regression test there? same question for benchmarking.
How to compare this work with another client?
atomashpolskiy - 1 hours ago
I have several hundred unit tests and also a bunch of integration
tests. While UTs usually test API of individual classes, each of
the ITs creates a swarm of local peers and launches a torrenting
session with certain conditions: seeders to leechers ratio,
downloading from .torrent file vs using a magnet link, PEX
enabled/disabled, encrypted vs raw message streams,
etc.Benchmarks (like in libtorrent) is something I'm looking
forward to, but the project is still in the early stage --
there's a lot to be done with regards to optimization, i.e.
switching to using NIO selectors, adding a caching layer, etc.
That's a lot of work, and that's why I'm looking for
collaborators, before investing more time into performance-
tuning.
atomashpolskiy - 7 hours ago
There are many great BitTorrent clients out there, yet I've made my
own and willing to share and attract collaborators!
yodsanklai - 1 hours ago
Just curious, how many hours do you think you've spent on this
project?
atomashpolskiy - 1 hours ago
I'd say something in the range of 500-1000 hours.
atomashpolskiy - 4 hours ago
Guys, I've added a code screenshot above the gif, is it better
now?
niroze - 5 hours ago
thank you!
jph - 6 hours ago
Thank you, your work is terrific! Good docs, good code, and I
especially like the ability to create custom code to write to
alternative storage.
atomashpolskiy - 6 hours ago
Thanks!! Yeah, I was pursuing such design that would allow to
replace/customize most of the parts, including the internals. As
a bonus, it makes it easier to continue working on the library as
the codebase grows (now nearing 25K lines of code)
wodencafe - 3 hours ago
Wow thanks man! This can be useful in a variety of circumstances!
styfle - 6 hours ago
I'm curious, it looks like the screenshot shows the author is using
a Mac. But Mac OS hasn't shipped with Java in several years. So why
Java? Is it simply familiarity, or are there other reasons?
jrs95 - 4 hours ago
This is a library for development. If you wanted to ship a client
based on this, you could do that and package it with the Java
runtime.
pvg - 6 hours ago
Most OS's don't ship with a C compiler, go, python 3, rust, arc,
etc, what does that have to do with anything?
soperj - 5 hours ago
Technically _most_ ship with a C compiler and a python compiler
since pretty well every linux distribution & bsd distribution
has those. But that really doesn't have anything to do with
which language you should use.
pvg - 5 hours ago
Technically, that's not true.
weberc2 - 5 hours ago
You're conflating developer tools with a language runtime.
Every popular OS ships with everything necessary to run a C,
Go, or Rust binary. Python 3 and Java both require a separate
runtime to be installed, but I will say that every Java CLI
I've used has had terrible startup performance.
pvg - 5 hours ago
I'm not conflating them and it's still a silly way to frame
the question. If you want to ask someone why they wrote
something in language X, just ask them that.
weberc2 - 4 hours ago
You're being pedantic; natural language is contextual for
better or worse. Anyway, asking "Why did you use Java", is
likely to be interpreted as a slight against the language
and thus be downvoted (indeed, his politely phrased
question was even downvoted when I saw it!).
atomashpolskiy - 5 hours ago
I'm using Lanterna, a Java library for creating text-based
terminal GUIs (https://github.com/mabe02/lanterna), and the
startup is 1-2 seconds. Can't recommend it enough
weberc2 - 5 hours ago
Good to know, but 1-2 seconds is still very slow compared
to a native app. I have an 8MB Go CLI application that can
startup and print its help in .05 seconds, and even that is
probably slow compared to a C or Rust equivalent.
deepsun - 5 hours ago
Well, printing stuff is easy. Just tried: $ time java
HelloWorld Hello, World real 0m0.088s user
0m0.088s sys 0m0.016s
pebers - 4 hours ago
That's presumably not loading any libraries at all though
- the time to being interactive (or just doing something
useful) will get worse as more bytecode has to be
decompressed and loaded.
Manozco - 5 hours ago
opening and quiting vim for a file of 2500 lines of C++ (so
with all the plugins and stuff) takes 0.030seconds. I don't
see how you can be satisfied with 2 seconds startup for a
terminal application
atomashpolskiy - 5 hours ago
I completely agree that for a interactive tool like text
editor startup time is crucial. But in my case being a
bit on the slow side is probably fine, because the UI is
for informational purposes only, and VLC takes around
5-10 seconds anyways to startup and begin playing the
file, that is being downloaded.
hdhzy - 3 hours ago
Well the torrent download will take a lot more than 2
seconds so that time is totally amortized.Besides this
comparison looks like a total bikeshedding unless you
plan on downloading torrents with vim.By the way the
project looks fantastic. I'll be giving it a try.The
alternative for just command line torrent on a *nix is
aria2 [0]. Works exactly as advertised.[0]:
https://sourceforge.net/projects/aria2/
rijoja - 1 hours ago
Well there is a truth to that. However this might be
something symptomatic. As power consumption is getting
more and more interesting nowadays, having a minimal
impact on system resources overall might still be a
sensible goal.
deepsun - 5 hours ago
Some apps just include JRE into the app package (+100MB), and
just use it if it's not provided by OS.But then you need to
provide different app packages for different OSes.
weberc2 - 4 hours ago
C, Go, and Rust would require different app packages for
different OSes--that's not a problem. The problem is
bundling a 100MB runtime for a CLI.
atomashpolskiy - 6 hours ago
A mix of both, actually. I've been using uTorrent for years until
2016, when I've decided to switch to some new OS X release. After
installing the system update, the old, ad-free version of
uTorrent has stopped working. The new version seemed a bloated
mess to me, so I've tried a few other clients, but was left
unsatisfied. Finally, in despair I've decided to write my own
client with simplistic command-line UI, with emphasis on
streaming movies. The sheer amount of new information in BEPs was
enough for me to decide to take the easiest route and use the
language, that I'm most familiar with.
gigatexal - 5 hours ago
Man this looks slick, going to give it a shot. Love the ability to
be able to download a magnet link from the CLI and not worry about
what some fancy GUI is doing in the background cuz I am paranoid.
atomashpolskiy - 5 hours ago
Thank you! Make sure to install
http://www.oracle.com/technetwork/java/javase/downloads/jce8...
to allow 160-bit cryptography and use -e flag to be completely
safe!I also have a simple shell script locally, that wraps the
java command, so I have to just type `btmagnet
AF0D9AA01A9AE123A73802CFA58CCAF355EB19F8` to download to a pre-
determined location (hardcoded in the script). I wonder if I
should share it on the CLI README page
sarnowski - 4 hours ago
> Make sure to install http://www.oracle.com/technetwork/java/j
avase/downloads/jce8.... to allow 160-bit cryptographyOr don't
use the Oracle proprietary distribution but the OpenJDK of your
operating system which normally doesn't exclude proper crypto
algorithms.(be aware that the JDKs downgrade silently if
certain libraries are missing in your host)
atomashpolskiy - 3 hours ago
That's some really useful information, thanks! Need to add
this to the readme
gigatexal - 5 hours ago
do it! that'd be my use case more or less.
atomashpolskiy - 4 hours ago
Done: https://github.com/atomashpolskiy/bt/tree/master/bt-
cli#shel...
lotyrin - 4 hours ago
I use rtorrent for exactly this.
hobarrera - 3 hours ago
Sounds like deluge (deluged) would have suited you fine.
pmatev - 5 hours ago
Credit to OP, this looks like a really solid project. The CLI
aspect of it reminds me of peerflix
(https://github.com/mafintosh/peerflix), which I've been using
for a while and am pretty happy with (no affiliation, promise)