Releases: Elchi-dev/bfnet
Release list
v0.2.0
Changelog
v0.2.0
New instructions, three of them:
&- accept a connection like~, but fork instead of blocking. A
new thread continues right after&with the new connection and the
current cell set to 1; the original thread also continues right
after&, with the current cell set to 0 and no connection, and
loops back around for the next one. This is what makes actual
concurrent connections possible - previously~meant one
connection had to fully finish before the next could even be
accepted.?- writes the connected peer's IPv4 address and port into the
current cell and the five after it (4 bytes IP, 2 bytes port,
big-endian), no pointer movement. Zeroed out if there's no
connection or the peer isn't IPv4.@- reads a NUL-terminated "host:port" string starting at the
current cell, tries to connect to it, and swaps it in as the new
,/.target on success. Writes 1 or 0 to the current cell
depending on whether it worked. Closes whatever connection was
there before.
Fixed: closing a connection while there were still unread bytes sitting
in the receive buffer made the kernel send an RST instead of a clean
FIN, which shows up client-side as "connection reset" even after a
full response had already gone out. Every path that closes or replaces
a connection now drains it first.
New examples:
examples/concurrent.bf- same fixed response as v0.1, but via&,
so multiple connections actually overlap instead of queueingexamples/whoami.bf- reads the peer's IP and port with?and
prints them back as readable decimal, not raw bytesexamples/notify.bf- responds to the caller, then uses@to fire
a fixed request at a second host as a side effectexamples/router.bf- real path-based routing: incoming path bytes
get compared against each route byte by byte, no checksum shortcuts.
Generated bytools/route_gen.pyrather than hand-written, since the
comparison logic gets long fast
New tools:
tools/bfbuilder.py- a small cursor-based code builder (tracks
pointer position automatically instead of hand-counting</>),
plus a decimal-printing subroutine built on ittools/route_gen.py- turns a(path, response)table into a
routed servertools/build_examples.py- regenerates all the generated examples
above from source, so they're reproducible rather than one-off output
Known limitation worth calling out: @ only gives you one connection
slot, same as ~ and & did. Once you connect out, the original
inbound connection is gone - there's no way to read from one
connection and write to another at the same time, so a true relay/
proxy isn't possible with the current instruction set. notify.bf
works around this by answering the real client before ever touching
@.
v0.1.0
First tagged release.
bf.py, brainfuck interpreter (standard 8 instructions, no more, no
less), plus~for TCP: block for the next connection, close
whatever was there before, become the new,/.targetrun.sh-socathandles the actual TCP listening, hands each
connection to the interpreter over stdin/stdoutexamples/hello-json.bf,examples/hello-text.bf- fixed responses,
same for every request regardless of pathtools/text2bf.py- turns raw bytes into the+/-/.sequence
that prints them
Superseded by the bfnet binary in v0.2.0, which replaces the
socat + Python interpreter pair with a single compiled interpreter
that also owns the TCP accept loop.
v0.1.0
Full Changelog: https://github.com/Elchi-dev/bfnet/commits/v0.1.0