feat: add Android APK with embedded I2P browser and torrent manager
check / check (ubuntu-latest) (push) Failing after 26s
check / check (macos-latest) (push) Failing after 29s
check / check (windows-latest) (push) Failing after 26s

- Add an Android app (org.mooni2p.browser) with an I2P WebView browser defaulting to insulaocculta.i2p, bookmarks, and a diagnostics dialog.
- Run the router in a foreground service and add a Torrents & DHT tab backed by the router API (manager.html).
- Handle magnet links and .torrent files from intents, the file picker, and .i2p downloads.
- Add scripts/build_apk.py and a `just apk` target that builds arm64-v8a and x86_64 APKs.
- Document the APK build and install steps in the README.
- Include related bittorrent, router, streaming, and ntcp2_net updates.
This commit is contained in:
nandi committed 2026-11-28 17:55:42 -08:00
1 parent fbe6818c4e
commit 7a1b4325f9
16 files changed
+3041 -78

No files matched your search

+65 -29
View File
@@ -101,32 +101,62 @@ fn StreamConnection::queue_packet(
}
///|
fn StreamConnection::current_nacks(self : StreamConnection) -> Array[UInt32] {
fn StreamConnection::wire_ack_and_nacks(
self : StreamConnection,
) -> (UInt32, Array[UInt32]) {
if self.ooo_recv.length() == 0 {
return []
return (self.ack_through, [])
}
let mut max_seen = self.next_recv_seq
let seqs : Array[UInt32] = []
for entry in self.ooo_recv {
if entry.0 > max_seen {
max_seen = entry.0
let s = entry.0
if s < self.next_recv_seq {
continue
}
}
let nacks : Array[UInt32] = []
let mut s = self.next_recv_seq
while s < max_seen && nacks.length() < 32 {
let mut found = false
for entry in self.ooo_recv {
if entry.0 == s {
found = true
let mut dup = false
for existing in seqs {
if existing == s {
dup = true
break
}
}
if !found {
nacks.push(s)
if !dup {
seqs.push(s)
}
s = s + 1U
}
nacks
if seqs.length() == 0 {
return (self.ack_through, [])
}
for i = 1; i < seqs.length(); i = i + 1 {
let key = seqs[i]
let mut j = i
while j > 0 && seqs[j - 1] > key {
seqs[j] = seqs[j - 1]
j -= 1
}
seqs[j] = key
}
let mut best_ack = self.ack_through
let nacks : Array[UInt32] = []
let mut cursor = self.next_recv_seq
for s in seqs {
if s < cursor {
continue
}
let gap = s - cursor
if gap <= 32U && nacks.length() + gap.reinterpret_as_int() <= 32 {
let mut m = cursor
while m < s {
nacks.push(m)
m = m + 1U
}
best_ack = s
cursor = s + 1U
} else {
break
}
}
(best_ack, nacks)
}
///|
@@ -354,12 +384,13 @@ fn StreamConnection::send_ack(
self : StreamConnection,
now_ms : UInt64,
) -> Unit raise StreamingError {
let (wire_ack, wire_nacks) = self.wire_ack_and_nacks()
let ack_pkt : StreamingPacket = {
send_stream_id: self.remote_stream_id,
recv_stream_id: self.local_stream_id,
sequence_num: 0U,
ack_through: self.ack_through,
nacks: self.current_nacks(),
ack_through: wire_ack,
nacks: wire_nacks,
resend_delay: b'\x00',
flags: 0U,
delay_requested: None,
@@ -479,8 +510,7 @@ pub fn StreamConnection::on_packet(
}
let seq = pkt.sequence_num
let has_data = pkt.payload.length() > 0 || (pkt.flags & flag_close) != 0U
if seq > 0U && has_data {
if seq > 0U && (pkt.flags & flag_synchronize) == 0U {
if seq == self.next_recv_seq {
for i = 0; i < pkt.payload.length(); i = i + 1 {
self.recv_buf.push(pkt.payload[i])
@@ -513,10 +543,14 @@ pub fn StreamConnection::on_packet(
self.send_ack(now_ms)
acked = true
}
if !acked && (pkt.flags & flag_delay_requested) != 0U {
match pkt.delay_requested {
Some(d) if d == 0U => self.send_ack(now_ms)
_ => ()
if !acked {
if (pkt.flags & flag_echo) != 0U {
self.send_ack(now_ms)
} else if (pkt.flags & flag_delay_requested) != 0U {
match pkt.delay_requested {
Some(d) if d == 0U => self.send_ack(now_ms)
_ => ()
}
}
}
}
@@ -543,12 +577,13 @@ pub fn StreamConnection::write(
let seq = self.next_send_seq
self.next_send_seq = seq + 1U
let flags = if self.has_recv_syn { 0U } else { flag_no_ack }
let (wire_ack, wire_nacks) = self.wire_ack_and_nacks()
let pkt : StreamingPacket = {
send_stream_id: self.remote_stream_id,
recv_stream_id: self.local_stream_id,
sequence_num: seq,
ack_through: self.ack_through,
nacks: self.current_nacks(),
ack_through: wire_ack,
nacks: wire_nacks,
resend_delay: b'\x00',
flags,
delay_requested: None,
@@ -592,12 +627,13 @@ pub fn StreamConnection::close(
}
let seq = self.next_send_seq
self.next_send_seq = seq + 1U
let (wire_ack, wire_nacks) = self.wire_ack_and_nacks()
let pkt : StreamingPacket = {
send_stream_id: self.remote_stream_id,
recv_stream_id: self.local_stream_id,
sequence_num: seq,
ack_through: self.ack_through,
nacks: self.current_nacks(),
ack_through: wire_ack,
nacks: wire_nacks,
resend_delay: b'\x00',
flags: flag_close |
flag_signature_included |