IRCaBot 2.1.0
GPLv3 © acetone, 2021-2022
#i2p-dev
/2022/03/26
@eyedeekay
&kytv
&zzz
+R4SAS
+RN
+RN_
+dr|z3d
+orignal
+postman
+wodencafe
Arch
DeltaOreo
FreeRider
FreefallHeavens
Irc2PGuest19353
Irc2PGuest22478
Irc2PGuest48042
Irc2PGuest64530
Irc2PGuest77854
Nausicaa
Onn4l7h
Onn4|7h
Over1
Sisyphus
Sleepy
Soni
T3s|4_
Teeed
aargh3
acetone_
anon4
b3t4f4c3
bak83_
boonst
cumlord
dr4wd3
eyedeekay_bnc
hagen_
hk
khb
not_bob_afk
plap
poriori
profetikla
r3med1tz
rapidash
shiver_1
solidx66
tr
u5657
uop23ip
w8rabbit
weko_
x74a6
mesh where is the source code for i2ptunnel?
mesh am I missing something, it's not part of the main i2p project?
eyedeekay mesh apps/i2ptunnel
mesh eyedeekay: thanks
eyedeekay no problem
mesh eyedeekay: do you know does i2ptunnel actually set a remote port when it connects to an eepsite?
eyedeekay Not offhand
eyedeekay It would also depend on think, the HTTP tunnel would be slightly different than the Standard tunnel
eyedeekay *type I think
eyedeekay I can look for where it happens really quick
eyedeekay actually, I'm going to suggest:
mesh eyedeekay: yes?
eyedeekay grep --color=always -Hni Port apps/i2ptunnel/java/src/net/i2p/i2ptunnel/*.java
eyedeekay grep --color=always -Hni TargetPort apps/i2ptunnel/java/src/net/i2p/i2ptunnel/*.java
eyedeekay grep --color=always -Hni ListenPort apps/i2ptunnel/java/src/net/i2p/i2ptunnel/*.java
eyedeekay If you want to see the code because that's exactly what I'm going to do
mesh eyedeekay: I think the question is there somebody out there that defaults remotePort to 80?
eyedeekay It looks like it's based on the scheme of the request, so 443 for https, 80 for http
eyedeekay Unless there's a port included
mesh it looks like when you go to a .i2p address remotePort isn't set unless the user puts the port in the requestUri
mesh that's too bad, but I guess we can say the default http port in i2p is actually 0
mesh nope it's port 80. Not sure why. But that's very good to know.
eyedeekay Ports are sort of a weird thing in I2P, especially at midnight on a friday, 99% of the time so far a b32 is the whole address, the port is sort of whatever the server is pointing at
eyedeekay Except when you're using multiple things on the same address, in which case there are ports that matter
eyedeekay Or when the server expects you to be connecting on a specific port and misbehaves if you don't
mesh eyedeekay: I don't know why but I just tested it in Firefox. My server received a request where clientSocket.getLocalPort() returned 80.
mesh It's quite possible that the web browser itself (Firefox) adds the :80 port transparently?
eyedeekay It's possible but I think around ~850 in I2PTunnelHTTPClient.java may be another answer
eyedeekay just a sec
eyedeekay OK that's for outproxies, but there's another place in that file I should look
eyedeekay Yeah, around line 653
eyedeekay well, 649-654
mesh eyedeekay: I was looking at 626 where it checkds for the ".i2p" ending and then only adds a remote port if one is in the requestUri
mesh I'm thinking the requestUri from the browser does default to include :80
eyedeekay It seems to add port 80 if there is no port in the request, or 443 if the scheme matches https
mesh yeah that's what I'm seeing
mesh eyedeekay: do you know how the jump/nameserver mechanism works?
mesh eyedeekay: I see when I go to the I2P HttpProxy Tunnel Configuration there is a "Jump Url List"
eyedeekay Pretty intricately, what do you want to know?
mesh eyedeekay: I was just wondering how zzz.i2p gets turned into a b32 address. Is that a jump thing or an Addressbook thing?
eyedeekay Well once you have the address, in the case of zzz.i2p you have it by default, you actually use the full destination
eyedeekay the b32 is just the hash(usually) of the destination
eyedeekay You use the b32 to do a lookup of the destination, but you can only get it if the destination is online
eyedeekay which technically makes it have a sort of variable time that it takes for a b32 to resolve to a destination
eyedeekay Whereas if you have a hostname registered, you know the destination because you already stored it
eyedeekay So it's pretty much instantaneous
mesh that's another question... how do you go from a .b32.i2p to a Destination object. I can do "new Destination($Base_64_String)" ... but don't see a mechanism for going from b32.i2p -> Base64...
eyedeekay That's because it's probably impossible
eyedeekay Well, without a lookup
eyedeekay But the b32 is the sha256sum of the destination so it's not reversible
mesh eyedeekay: I can put .b32.i2p addresses into firefox and I2PTunnel/HttpProxy does seem to correctly turn those into base64 addresses?
mesh at least I can see the HTTP requests from Firefox arriving at my server
eyedeekay Yes because the hosts are publishing the destination so you can use the base32 to find it
eyedeekay If the hosts were down, it would not work anymore
mesh eyedeekay: Ok. But presumably there is some Java code somewhere in the tunnel where it turns the .b32.i2p into a base64? Is that like a router lookup?
eyedeekay Yeah let me get that bit open
eyedeekay grep for getDestination IIRC
eyedeekay Yes, which will lead you up to I2PSession.java, but that's going to take us a little further still
mesh I see. So I can just pass a .b32.i2p address to I2PSession.lookupDest(String name) ?
eyedeekay Yeah pretty much that's how it happens from I2PTunnel
mesh this code } else if (destination.toLowerCase(Locale.US).endsWith(".b32.i2p")) { is interesting
eyedeekay Yeah I see that
eyedeekay Interesting in what way?
eyedeekay base32 is sort of a specific alphabet in terms of bytes, everybody uses a-z:2-7
mesh eyedeekay: I guess this is the actual code for .b32.i2p
mesh if (len == 60) { byte[] hData = Base32.decode(destination.substring(0, 52)); if (hData != null) {
mesh if (_log.shouldInfo())
mesh _log.info("lookup b32 in-session " + destination);
mesh Hash hash = Hash.create(hData);
mesh clientDest = sess.lookupDest(hash, 20*1000);
mesh but then I'm curious about the "else if (len >= 64)"
mesh won't .b32.i2p always be 60 characters?
eyedeekay Encrypted/Blinded leasesets
eyedeekay They're a little longer sometimes
eyedeekay That's the "usually" in "usually" the sha256 by the way
mesh eyedeekay: you're saying that even without encrypted leasesets, some .b32.i2p addresses can be longer than 60?
eyedeekay No, only with encrypted or blinded leasesets
eyedeekay In which case the way you get from base32 to destination is obviously a little different
eyedeekay That's the base32 half of it
mesh eyedeekay: ok thank you. I am going to learn about encrypted leasesets in the future. One step at a time :)
mesh eyedeekay: My original question: when I put zzz.i2p into Firefox this doesn't use I2PSession.lookup, right? Because zzz.i2p is not a .b32.i2p address.
mesh I assume that somehow I2PTunnel is about to talk to the "Addressbook" at 127.0.0.1:7667/dns ?
eyedeekay Yes that is correct
mesh the code is soing something with addressHelpers and _context
mesh ok, interesting. there is something called I2PAppContext that comes from an I2PTunnel.
mesh I guess this functionality is only available to code that runs inside the Java Router?
eyedeekay But you need to be looking for endsWith(".i2p") I think and working out from there
eyedeekay And not exactly
mesh eyedeekay: I can use I2PAppContext for an external app that doesn't run inside the router?
eyedeekay No you can't
eyedeekay But part of what some of the API's are arguably "for" is to provide the most important information you get from the I2PAppContext to them without needing them to be plugins or part of the core code
mesh eyedeekay: that's what I had thought. I guess the question then is there a way for external apps to access I2PAppContext.getNamingService()?
eyedeekay If push came to shove, a plugin could do something really bass-ackwards and be like `export SOMEWIERDTHING=$(java -cp $I2P/lib/*.jar somewierdcommand iwanttheoutputof)`
eyedeekay But that would be ill-advised
eyedeekay i2pcontrol is a better choice
eyedeekay I guess it doesn't cover everything, you can't manipulate the i2pappcontext
mesh eyedeekay: that would only work if the router is runnning on localhost. I think in a perfect world the Router would have a REST API that people could contact to use the nasming service. But this is good to know. Thank you.
eyedeekay It seems like it would be pretty simple to build a RESTful API based on SAM
mesh eyedeekay: I think what I2PTunnel is first check the naming service, than try to use I2PSession.lookup, and then, as a last resort, use the jump service.
eyedeekay Except for the implication that REST is always HTTP that I get when I type software architecture terms into DuckDuckGo, I don't actually know why SAM LOOKUP's wouldn't qualify as restful
eyedeekay As far as I can tell, that is the order things happen in mesh
eyedeekay Well, it's more like
eyedeekay --+---b32------found?-----site
eyedeekay | +-------not found--error page
eyedeekay +---hostname---found----site
eyedeekay +-------not found--jump service--found----site
eyedeekay +----not found--error page
mesh eyedeekay: thank you. This helps a lot.
eyedeekay Wishlist for an IRC replacement: easier drawing/diagrams
mesh eyedeekay: BTW I think you wrote a document about running a "high capacity" i2p router?
eyedeekay Did I? Honestly I lost track of all the things I've written but that doesn't sound very familiar
eyedeekay At best I wrote about the bandwidth tool or something
eyedeekay Anyway, I gotta go, I'll be back in the morning
mesh eyedeekay: bye
zzz perfect answers for everything except:
zzz <mesh> eyedeekay: I can use I2PAppContext for an external app that doesn't run inside the router?
zzz <eyedeekay> No you can't
zzz the correct answer is yes, that's the API for both internal and external clients
zzz dr|z3d, ....
zzz hi mesh
mesh zzz: hello
zzz you kept idk up past his bedtime, not his fault, but one correction:
zzz <mesh> eyedeekay: I can use I2PAppContext for an external app that doesn't run inside the router?
zzz <eyedeekay> No you can't
zzz the correct answer is yes, that's the API for both internal and external clients
mesh zzz: really. So if I call I2AppContext.getNamingService() will it go to the router's addressbook even for external apps?
zzz yes, I think that's the way it works
zzz although if you already have a I2CP session, using it for the lookup is more efficient
mesh zzz: thanks. I will give it a shot.
zzz see the I2PSession API
mesh zzz: yeah, eyedeekay showed me the I2PSession.lookup methods.
mesh zzz: btw, I've been running 1.7 under jdk18 and it significantly reduces router memory
mesh not sure if it's common knowledge but at least for me jdk18 with G1GC seems to have reduced memory cost by nearly 50%
zzz 17?
zzz the string compression in recent JVMs really helps
mesh jdk18 which came out 4 days ago. openjdk.java.net/projects/jdk/18
zzz anyway, for an external socket-oriented application, you should bundle only i2p.jar, mstreaming.jar, and streaming.jar. That's your API, and everything in there should be well-javadoc'ed.
mesh zzz: yes StringDeduplication helps. G1GC also received significant memory optimizations in jdk18: tschatzl.github.io/2022/03/14/jdk18-g1-parallel-gc-changes.html
zzz not dedup... I mean the internal 8-byte storage for ascii instead of UTF-16. That was a few releases back
zzz but thanks for the links
mesh zzz: right now I am trying to enhance the echo server example to speak http when it is contacted on port 80 but do normal echo'ing on port 125. it mostly seems to be working.
zzz ok. you just playing around or you have an application in mind?
mesh zzz: I am still learning. I will soon try to create a kind of blogging app.
mesh it will receive custom commands on one port, and speak http on port 80 not unlike what I am trying to do with the echo app.