522 Commits

Author SHA1 Message Date
eyedeekay
61008ce988 fix test 2025-08-14 16:43:16 -04:00
eyedeekay
294cd52343 fix test 2025-08-14 16:40:12 -04:00
eyedeekay
322b431e8f move constants to own file 2025-08-14 16:34:01 -04:00
eyedeekay
79df514a2f Refactor ReadBuilRequestRecord 2025-08-14 16:27:11 -04:00
eyedeekay
36762c61c5 fix race in sntp 2025-08-14 16:22:20 -04:00
eyedeekay
a8ac47431e reorganize netDb directory 2025-08-14 16:15:46 -04:00
eyedeekay
bd947ec2ca gofmt 2025-08-14 15:58:59 -04:00
eyedeekay
61700c8a05 refactor long ReSeed function in lib/netdb 2025-08-14 15:53:38 -04:00
eyedeekay
d6b8918a14 refactor long ReadFrom and GetRouterInfo function in lib/netdb 2025-08-14 15:46:20 -04:00
eyedeekay
43aa3a72a6 refactor long WriteTo function in lib/netdb 2025-08-14 15:33:23 -04:00
eyedeekay
5d04d24bc5 Refactor long functions Lookup and findClosestPeers in the netdb package 2025-08-14 15:28:16 -04:00
eyedeekay
f168794ca3 start working on the netDb 2025-08-14 15:12:34 -04:00
eyedeekay
9c9f19b904 update godoc 2025-08-13 03:15:49 -04:00
eyedeekay
f176d4a97f am eliminate make test target 2025-08-13 03:15:06 -04:00
eyedeekay
e89876903f update README.md and ROADMAP.md with current post-NTCP2 status 2025-08-13 03:12:03 -04:00
eyedeekay
c6f8bf6447 Test outbound transport 2025-08-13 01:47:21 -04:00
eyedeekay
32075c20c7 NTCP2 Outbound connections 2025-08-12 20:51:00 -04:00
eyedeekay
4862c0314c Check in NTCP2 Transport/Session implementation. We can now listen. 2025-08-09 00:12:50 -04:00
eyedeekay
7f57cebd3f i2np interface-driven refactor 2025-08-08 23:23:13 -04:00
eyedeekay
c418914e95 Work on I2NP messages 2025-08-08 22:58:20 -04:00
eyedeekay
0e12cbfb70 fmt 2025-08-05 22:06:06 -04:00
eyedeekay
a8a3d61a75 start migrating to the ntcp2 library in go-noise for most layers of NTCP2 library 2025-08-05 22:05:31 -04:00
eyedeekay
96f7958543 more doc updates 2025-08-05 17:04:17 -04:00
eyedeekay
230646f34d update modules and README.md 2025-07-24 13:50:27 -04:00
eyedeekay
3b06be5eca remove su3 library to other location 2025-07-16 14:34:29 -04:00
eyedeekay
f4a89c74e0 Refactor long reseed functions to smaller functions 2025-07-15 20:46:48 -04:00
eyedeekay
1529f18fa1 Refactor long ntcp2 functions to smaller functions 2025-07-15 20:42:13 -04:00
eyedeekay
3be24a6a42 Refactor long su3 function to smaller functions 2025-07-15 20:33:27 -04:00
eyedeekay
e4e8631b0e Re-organized noise package 2025-07-15 20:28:03 -04:00
eyedeekay
2a3cfcfac3 re-generate godoc 2025-07-15 19:58:45 -04:00
eyedeekay
e1756bdf39 Fix documentation: mark I2NP message parsing as implemented 2025-07-15 19:53:27 -04:00
eyedeekay
975970152e secure RouterInfoKeystore private key file permissions 2025-07-15 19:48:39 -04:00
eyedeekay
bd6ce7b25f replace error string with safe fallback IDs in KeyID generation 2025-07-15 19:46:40 -04:00
eyedeekay
7470d80def Fix critical security issue: secure private key file permissions and path construction 2025-07-15 19:41:59 -04:00
eyedeekay
4997ceebae fix test failures 2025-07-15 19:36:05 -04:00
eyedeekay
637293f13e fix test 2025-07-15 19:14:55 -04:00
eyedeekay
2d083bfe90 fix length bit related encr/decr bug 2025-07-15 19:04:22 -04:00
eyedeekay
29388af798 give noise test it the whole packet with the length bit 2025-07-15 18:58:27 -04:00
eyedeekay
f9127c0998 Update various things to post-refactor API interfaces 2025-07-15 18:28:02 -04:00
eyedeekay
b9e73d816d update modules 2025-07-08 21:55:30 -04:00
eyedeekay
4edc7b392d move common into it's own package, because it's getting hard to keep track of everything in here. Also going to move crypto into it's own package soon. This way common and crypto will have their own CI and will be able to present stable interfaces before the rest of go-i2p is ready. 2025-07-07 15:15:27 -04:00
eyedeekay
d7888ac9be return corrected size 2025-06-28 13:53:13 -04:00
eyedeekay
68408bb48e Expose WriteMessageToConn and start work on sessions 2025-05-31 13:40:33 -04:00
eyedeekay
4715b76ade IGNORE THIS CHECKIN: regenerate call graphs, regenerate godoc 2025-05-15 20:30:26 -04:00
eyedeekay
ac7e369b6a work on reseeding 2025-05-15 20:20:46 -04:00
eyedeekay
7d51d83b40 Fix nil return in when performing noise handshake to return a session 2025-05-15 19:20:37 -04:00
eyedeekay
89c82cb2fe Remove unused function, fix spelling, update godoc 2025-05-15 19:17:42 -04:00
eyedeekay
808f7d6fdf move processors back due to import cycle 2025-05-15 19:03:41 -04:00
eyedeekay
537ab808f8 fix issues with transports 2025-05-15 18:56:10 -04:00
eyedeekay
b41bb0eef8 move sessionmessageprocessors to own directory 2025-05-15 18:42:39 -04:00
eyedeekay
8787fea069 Put an X over handshake. It's broken, but it's there! 2025-05-10 23:22:43 -04:00
eyedeekay
fc9734d43d fix page workflow 2025-05-10 23:19:50 -04:00
eyedeekay
0a262d5780 Add GitHub Actions workflow for page generation 2025-05-10 23:15:45 -04:00
eyedeekay
2f233e931d delete more now-unused functions 2025-05-10 23:13:47 -04:00
eyedeekay
e9991099b7 update godoc again, delete more now-unused functions 2025-05-10 23:13:11 -04:00
eyedeekay
761dcb5f98 get rid of math/rand usages 2025-05-10 23:09:22 -04:00
eyedeekay
f68d9b5606 check in utility functions 2025-05-10 23:03:53 -04:00
eyedeekay
9fd3400585 More function deletions 2025-05-10 22:55:39 -04:00
eyedeekay
c85822163b Regenerate godoc 2025-05-10 22:36:36 -04:00
eyedeekay
e2fdb7c4e0 Move to SessionProcessors 2025-05-10 22:33:43 -04:00
eyedeekay
1babf06091 More code deduplication 2025-05-10 22:18:50 -04:00
eyedeekay
62e565b36c More code deduplication 2025-05-10 22:16:25 -04:00
eyedeekay
c7a17eac86 fmt 2025-05-10 21:55:30 -04:00
eyedeekay
89e53fdb9f More migration to processors 2025-05-10 21:55:06 -04:00
eyedeekay
ebdd1ae0aa Work on implementing and migrating to message processors 2025-05-10 21:46:07 -04:00
eyedeekay
b65f6c2682 Work on implementing and migrating to message processors 2025-05-10 21:43:30 -04:00
eyedeekay
14a0e56f6a Work on implementing and migrating to message processors 2025-05-10 21:37:47 -04:00
eyedeekay
4a89c14734 Work on implementing and migrating to message processors 2025-05-10 21:23:05 -04:00
eyedeekay
09fe22178d more method consolidation 2025-05-10 21:12:49 -04:00
eyedeekay
ef156f6944 more method consolidation 2025-05-10 21:11:46 -04:00
eyedeekay
a4acb01be9 handshake interface implementation stuff 2025-05-10 20:25:02 -04:00
eyedeekay
dd116095aa More duplicated code reduction, interface improvement 2025-05-10 20:09:42 -04:00
eyedeekay
1922f3a0ab Start implementing messages as message processors 2025-05-08 23:22:42 -04:00
eyedeekay
2a28c8ee01 Start implementing the message handlers 2025-05-08 22:59:36 -04:00
eyedeekay
9cb4af8f06 plan new handshake interfaces 2025-05-08 21:41:09 -04:00
eyedeekay
56faebd746 Plan re-org of handshake functions 2025-05-08 20:29:46 -04:00
eyedeekay
8b035711b6 Move sessionRequest methods to own file, organization changes 2025-05-08 18:01:58 -04:00
eyedeekay
c93b258844 Move ntcp2 messages into ntcp2 directory 2025-05-08 16:22:22 -04:00
eyedeekay
2df5d23528 Implement findClosestPeers 2025-05-08 14:24:08 -04:00
eyedeekay
98ea3d55c4 Implement lookup for kadResolver, change kadresolver to KademliaResolver 2025-05-07 21:19:46 -04:00
eyedeekay
b5454a4317 Implement lookup for kadResolver, change kadresolver to KademliaResolver 2025-05-07 21:17:38 -04:00
eyedeekay
83502face7 change lookup interface, needs to be more intuitive to use, we can thread elsewhere 2025-05-07 20:51:30 -04:00
eyedeekay
c99b15ba7f NetDB entry serialization and deserialization, TODO: leaseset struct port 2025-05-07 20:14:18 -04:00
eyedeekay
8e73c36922 check in the stuff I have locally that I haven't yet, mostly ECDSA stuff which is not very useful 2025-05-05 22:37:46 -04:00
eyedeekay
89b1995593 ecdsa_p256_private impl, rest of ecdsa to follow 2025-04-04 11:00:59 -04:00
eyedeekay
4577408d6d return a descriptive error upon a hash size mismatch 2025-04-03 17:00:10 -04:00
eyedeekay
e7e26ae021 Fix unimplemented funcs in rsa3072 2025-04-03 15:53:17 -04:00
eyedeekay
1d1568de71 Add rsa4096 implementation and use the same functin for all key reads 2025-04-03 15:30:06 -04:00
eyedeekay
b21a6cee9e Add rsa2048 implementation 2025-04-03 15:04:39 -04:00
eyedeekay
35b47969b0 Add rsa3072 implementation 2025-04-03 14:57:08 -04:00
eyedeekay
816df5642c implement first handshake message sender and reciever, create a test file 2025-03-31 21:49:31 -04:00
eyedeekay
1bd439f989 Implement Sender for Handshake Message 1 2025-03-31 17:33:01 -04:00
eyedeekay
6158eb68f3 fix some interfaces 2025-03-31 14:56:04 -04:00
eyedeekay
03eeeab781 reorganized old hansdhake stuff 2025-03-31 14:55:05 -04:00
eyedeekay
0099392f6d fix some interfaces 2025-03-31 14:51:53 -04:00
eyedeekay
a09f155835 Add quantized padding file and my notes on quantized padding 2025-03-31 13:46:45 -04:00
eyedeekay
fa561fc431 Merge branch 'master' of github.com:go-i2p/go-i2p 2025-03-29 17:54:58 -04:00
eyedeekay
c5125c1bfd more ntcp2 progress, figure out what the rules of the crypto library interfaces need to be, etc 2025-03-29 17:54:23 -04:00
idk
9e1bac3ff1 Merge pull request #37 from satk0/add-database-lookup
Add DatabaseLookup
2025-03-29 14:41:44 -04:00
eyedeekay
b4e1f3cfdf THIS LARGE CHECKIN CONTAINS REGENERATED DOCS ONLY. update/regenerate docs. 2025-03-27 22:18:24 -04:00
eyedeekay
d4ff0e373c stub out more methods 2025-03-27 22:01:34 -04:00
eyedeekay
0c9c8270a5 migrate hmac to crypto/hmac, I swear we do everything the hard way... 2025-03-27 21:56:23 -04:00
eyedeekay
f2bacc5018 Add basic chacha20-poly1305 implementation 2025-03-27 21:45:23 -04:00
eyedeekay
94691f1e75 Stub out ECDSA requirements 2025-03-27 20:30:31 -04:00
eyedeekay
8c4f718601 Make all the tests compile again, some of the elgamal ones might fail but mixing up our packages with third-party elgamal packages was causing problems. We should bring crypto in-house as dependencies, wrap our interfaces around it per our requirements, and not touch the upstream library if we can help it. That means wrap private keys, public keys, signing and encryption operations with our own code reporting our own errors. 2025-03-27 20:13:17 -04:00
eyedeekay
9a0d164276 Use curve25519+ChaCha20-Poly1305 instead of AES-GCM in curve25519, I think we might need to override it sometimes but it's the thing that makes sense right now 2025-03-27 19:50:55 -04:00
eyedeekay
f3f5d744ed Fix curve25519 decrypter 2025-03-27 19:24:23 -04:00
eyedeekay
3b9fb603f4 fix a few more compile errors and sync 2025-03-26 21:10:16 -04:00
eyedeekay
29d5a20216 Fix compile errors in NTCP handshake 2025-03-26 19:38:01 -04:00
eyedeekay
3c252e22cd split the rsa stub package into one file per component 2025-03-26 19:32:54 -04:00
eyedeekay
dcb11d1fda split the rsa stub package into one file per component 2025-03-26 19:31:32 -04:00
eyedeekay
a721856688 split the elgamal package into one file per component 2025-03-26 19:26:03 -04:00
eyedeekay
b66c5813cb split the ed25519 package into one file per component 2025-03-26 19:19:24 -04:00
eyedeekay
441549743d Fix some of the compile errors in routerinfo_keystore.go 2025-03-26 18:57:27 -04:00
eyedeekay
30f84713ea split the ecdsa package into one file per component 2025-03-26 18:52:51 -04:00
eyedeekay
6057677956 split the dsa package into one file per component 2025-03-26 18:48:12 -04:00
eyedeekay
c026b9a4a5 split the curve25519 package into one file per component 2025-03-26 18:40:38 -04:00
eyedeekay
9c6cfc14e5 split the curve25519 package into one file per component 2025-03-26 18:40:31 -04:00
eyedeekay
4533c2fd92 split the aes package into one file per component 2025-03-26 18:24:31 -04:00
satk0
89e51820f1 Add DatabaseLookup and test it 2025-03-26 20:32:44 +01:00
eyedeekay
17a789bed7 refactor crypto library into smaller components 2025-03-25 19:08:47 -04:00
eyedeekay
d236f19f81 add custom handshake manager 2025-03-25 18:37:14 -04:00
eyedeekay
d0b81d9ce9 add remaining session messages 2025-03-25 18:17:34 -04:00
eyedeekay
06cf6b41b4 add remaining session messages 2025-03-25 18:15:44 -04:00
eyedeekay
ac8349d083 Add SessionCreated implementation 2025-03-25 17:02:25 -04:00
eyedeekay
45296be6d3 let the machine find simple errors in the common library and call it a night 2025-03-24 23:55:04 -04:00
eyedeekay
1f25f0c9b3 Finish initialization of NTCP2Sessions 2025-03-24 23:22:23 -04:00
eyedeekay
d1a708a594 Actually use the message objects, duh 2025-03-24 23:16:12 -04:00
eyedeekay
b153bfc050 Refactor and comment ComposeInitiatorHandshakeMessage 2025-03-24 19:36:14 -04:00
eyedeekay
d401b06c0f Remove dot-imports from LeaseSets 2025-03-22 18:49:26 -04:00
eyedeekay
9091834074 fix more tests 2025-03-22 18:12:13 -04:00
eyedeekay
8561b3ec69 fmt 2025-03-22 18:03:24 -04:00
eyedeekay
8aac97351d fix some tests 2025-03-22 18:03:06 -04:00
idk
3142a394aa Merge pull request #31 from go-i2p/ntcp
NTCP2 Handshake Development
2025-03-21 15:48:13 -04:00
eyedeekay
f2b6d4bc01 Refactor noise locked read/write, move handshake out to own interface 2025-03-19 22:28:14 -04:00
eyedeekay
fa0a42855c move padding 2025-03-19 17:20:33 -04:00
eyedeekay
3212cae276 fix tests that failed because of inconsistent usage of crypto API 2025-03-09 14:04:43 -04:00
eyedeekay
ad7bac666b Merge branch 'ntcp' of github.com:go-i2p/go-i2p into ntcp 2025-03-09 14:02:42 -04:00
eyedeekay
ba0c89d567 fix tests that failed because of inconsistent usage of crypto API 2025-03-09 14:02:10 -04:00
idk
6a64b28bb3 Merge pull request #39 from urgentquest/better-config-file-handling
Better config file handling
2025-03-09 13:52:15 -04:00
ungrentquest
9fa714f648 typo 2025-03-05 20:03:31 +00:00
ungrentquest
eda403443d Some additional tweaks. Split out actual config handling. Add an auxiliary func to build i2p base directory path 2025-03-05 00:40:43 +00:00
ungrentquest
84cc45d3e4 Refactor config handling
- Replace low-level operations like file existance checks, file io with viper calls.
That also allows to get rid of manual config structure initialization.
- Split out UserHome() into itil/home.go to reduce code duplicacy.
- Better error handling and general readbility.
2025-03-04 23:59:38 +00:00
eyedeekay
598ee1eb70 Merge branch 'ntcp' of github.com:go-i2p/go-i2p into ntcp 2025-03-02 16:44:43 -05:00
eyedeekay
bd6edf446d Fix some tests 2025-03-02 16:43:47 -05:00
idk
94e43f8aa6 Merge pull request #38 from urgentquest/ntcp-go-fix-null-pointer-dereferences
ntcp/session.go: fixes and imrovements
2025-03-02 15:46:45 -05:00
ungrentquest
7bdaf6d4ea ntcp/session.go: fixes and imrovements
- Stop using deprecated (and probably
not cryptographically secure) exp/rand, switch to crypto/rand instead
- Reduce code duplicacy by defining `buildAesStaticKey()` method
- Properly handle pointer to `crypto.AESSymmetricKey` struct
to prevent nil pointer dereferences
- go mod tidy
2025-03-01 21:19:53 +00:00
eyedeekay
393263294e update CONTRIBUTING.md 2025-02-27 12:53:55 -05:00
eyedeekay
55f92bdd8a update CONTRIBUTING.md 2025-02-27 11:17:57 -05:00
eyedeekay
8ea238f3dd add template for docs 2025-02-27 10:33:01 -05:00
eyedeekay
91d8b30495 Add callgraphs to docs 2025-02-26 21:03:51 -05:00
eyedeekay
ea4d126358 Add callgraphs to docs 2025-02-26 20:58:20 -05:00
eyedeekay
f46bd95b68 Add callgraphs to docs 2025-02-26 20:52:16 -05:00
eyedeekay
35eb66084b add the ability to generate callgraphs 2025-02-26 20:38:46 -05:00
eyedeekay
a9289dd4d3 add the ability to generate callgraphs 2025-02-26 20:38:29 -05:00
eyedeekay
7f78fdf784 Add new, address generation functions 2025-02-26 19:31:57 -05:00
eyedeekay
ae4970b3a9 Switch to oops for error configuration so we can get more info about failures 2025-02-26 19:22:48 -05:00
eyedeekay
3d6a08a76b start building NTCP2 addresses 2025-02-26 19:13:05 -05:00
eyedeekay
18b2afe828 create and store our own RI with private keys 2025-02-26 14:44:02 -05:00
eyedeekay
c6867e0b16 more keystore work 2025-02-25 16:15:18 -05:00
eyedeekay
d0b4db769e Work on setting up a routerinfo from a keystore 2025-02-16 15:09:12 -05:00
eyedeekay
26a9a00b34 Work on setting up a routerinfo from a keystore 2025-02-16 14:38:06 -05:00
eyedeekay
99df4c7ce8 Little more RI private key stuff just to be sure where I think it should go 2025-02-15 22:19:46 -05:00
eyedeekay
b95b0c4fa3 start working on basic key storage for own RI private keys 2025-02-15 22:17:32 -05:00
eyedeekay
036f9116a5 start working on basic key storage for own RI private keys 2025-02-15 22:16:31 -05:00
idk
d97624282e Merge pull request #35 from satk0/i2np-build-res
Add i2np Build Response Record
2025-02-11 14:12:08 -05:00
satk0
46af6d55ef Update upload-artifact in workflow 2025-02-11 13:19:39 +01:00
satk0
9591f496eb Add BuildResponseRecord 2025-02-11 13:15:47 +01:00
eyedeekay
71fff44d4b Merge branch 'master' of github.com:go-i2p/go-i2p into ntcp 2025-02-10 16:44:55 -05:00
eyedeekay
6b2f231c36 spk and cpk reads were reversed 2025-02-10 16:41:59 -05:00
eyedeekay
4eeaf915f0 sam and tunnel manager are now freestanding apps 2025-02-09 12:29:17 -05:00
eyedeekay
440b9e8118 revise logging around SPK stuff in router_info.go 2025-01-30 15:49:28 -05:00
eyedeekay
8bc5ca162a NTCP2: Change noise interface so we get static keys from better places 2024-12-21 22:13:03 -05:00
eyedeekay
bd92221d56 Merge branch 'master' of github.com:go-i2p/go-i2p into ntcp 2024-12-21 19:52:28 -05:00
idk
22111a6cb7 Merge pull request #30 from satk0/add-signature-tests
Add signature tests
2024-12-14 00:19:14 +00:00
eyedeekay
74d2998e10 Try and reason with the ways of getting local and remote static keys in the transports 2024-12-13 16:59:46 -05:00
satk0
0b89baf98b Add signature tests to doc/tests and actions 2024-12-13 22:42:29 +01:00
satk0
daac1a59b5 Add more signatures 2024-12-13 18:30:15 +01:00
satk0
6f65a7c068 Add signature tests 2024-12-13 15:26:21 +01:00
eyedeekay
db91315582 Make the arguments to ComposeInitatorHandshakeMessage comprehensible 2024-12-12 14:55:40 -05:00
idk
5f3a7f2340 Merge pull request #26 from hkh4n/tests
Refactoring tests
2024-12-04 21:18:57 +00:00
Haris Khan
8494da07a7 deprecate unused functions, deferring non-working test functions for later 2024-12-04 03:37:31 -05:00
Haris Khan
832e0d9114 Ed25519PrivateKey Public() modification 2024-12-04 02:22:54 -05:00
Haris Khan
8d56d033ae flux 2024-12-04 01:40:23 -05:00
Haris Khan
ad22d3e249 flux 2024-12-04 01:28:13 -05:00
Haris Khan
f55788e8ab flux 2024-12-04 01:18:54 -05:00
Haris Khan
2a4f4d6186 successful flux 2024-12-04 01:14:38 -05:00
Haris Khan
ca1180c57f added cert tests and experimental function NewCertificateDeux 2024-12-04 00:55:53 -05:00
Haris Khan
76c3e5f293 WHAT IS HAPPENING RIGHT NOW 2024-12-04 00:02:33 -05:00
Haris Khan
91abe52725 flux 2024-12-03 23:22:14 -05:00
Haris Khan
a0ad9e0122 flux 2024-12-03 23:12:34 -05:00
Haris Khan
b23edc28d1 flux 2024-12-03 23:07:52 -05:00
Haris Khan
b547faf286 flux 2024-12-03 21:24:32 -05:00
Haris Khan
a145555bb2 flux 2024-12-03 19:27:41 -05:00
eyedeekay
280c877d39 Merge branch 'master' of github.com:go-i2p/go-i2p into ntcp 2024-12-01 15:41:24 -05:00
eyedeekay
ef4d4658c0 NTCP2: Add CreateSessionRequest to implement handshake 1 message, modify ComposeInitiatorHandshakeMessage to actually send it 2024-12-01 15:27:42 -05:00
Haris Khan
15bf28403e exported KeyCertificate 2024-12-01 01:28:38 -05:00
Haris Khan
b40c0ab6f9 fixed crypto public key size 2024-12-01 01:13:53 -05:00
Haris Khan
b952be5e08 build test (redo) 2024-11-30 18:33:39 -05:00
Haris Khan
aafbf74986 revert build test 2024-11-30 18:30:02 -05:00
Haris Khan
3cdc5676eb build test 2024-11-30 18:27:54 -05:00
Haris Khan
d41efdba0e adjusted tests.yml and Makefile 2024-11-30 17:43:51 -05:00
Haris Khan
edc436ac39 Merge branch 'master' into tests
# Conflicts:
#	Makefile
2024-11-30 17:30:47 -05:00
idk
414b489b37 Merge pull request #29 from hkh4n/workflow2
Adjust github workflows
2024-11-30 22:11:49 +00:00
Haris Khan
da875738e4 fix typos 2024-11-28 22:46:48 -05:00
Haris Khan
2a027ebb6c added lease_set.mk + add to Makefile 2024-11-28 22:44:51 -05:00
Haris Khan
d658dee6de correct filename + add to Makefile 2024-11-28 22:43:20 -05:00
Haris Khan
8fde3c9400 updated lease_set.mk 2024-11-28 22:40:20 -05:00
Haris Khan
9421374384 are tests running? 2024-11-28 20:18:03 -05:00
Haris Khan
daad2dcacd dont fail fast on CI 2024-11-28 20:16:10 -05:00
Haris Khan
5f8dc3f9a2 matrix x2 2024-11-28 20:14:05 -05:00
Haris Khan
9cc2e8f410 matrix 2024-11-28 20:13:21 -05:00
Haris Khan
6ac46aa747 Run aggregated tests 2024-11-28 20:07:37 -05:00
Haris Khan
5548b865b4 Adjusted makefile
-moved make test-all to just make test
-removed make test-all from tests.yml
2024-11-28 18:42:23 -05:00
Haris Khan
55245b2aa7 added more logging 2024-11-26 23:06:21 -05:00
Haris Khan
208051f92d strange error: publicKey has invalid size: expected 0, got 256 2024-11-26 23:03:17 -05:00
Haris Khan
8a672ca6ca adjust var names 2024-11-26 22:10:53 -05:00
Haris Khan
45def9dd0c Merge branch 'master' into tests 2024-11-26 22:08:46 -05:00
Haris Khan
cb1da321b9 added tests.yml 2024-11-26 22:02:31 -05:00
Haris Khan
d291624436 fixed auto-assign.yml 2024-11-26 22:01:52 -05:00
Haris Khan
a58f64566f Destination size 363 -> Fail 2024-11-26 21:28:02 -05:00
Haris Khan
891d915bb2 TODO 2024-11-26 20:30:37 -05:00
Haris Khan
a0a8704c6c mapping.size = size to fix dereference panic 2024-11-26 20:30:31 -05:00
Haris Khan
c68acf848e Corrected ValuesToMapping to order correctly 2024-11-26 19:56:32 -05:00
Haris Khan
7a6927cf53 gofumpt 2024-11-26 19:47:17 -05:00
Haris Khan
37e11ffee1 adjust generateTestRouterInfo 2024-11-26 15:56:41 -05:00
Haris Khan
e15e427f60 return error + uniform naming 2024-11-26 15:56:29 -05:00
Haris Khan
f0803a095e tweaks 2024-11-26 15:55:50 -05:00
Haris Khan
bf7e88bec1 updated test functions to not panic 2024-11-24 14:34:14 -05:00
Haris Khan
065ceeb88f Various changes
-removed outdated test functions (to be replaced later)
-added working experimental ReadKeysAndCert replacement candidate ReadKeysAndCertDeux
-added readCertificateFromEnd
-added constructPublicKey
-exported SpkType and CpkType in KeyCertificate
-added CryptoPublicKeySize() method
-added SigningPublicKeySize() method
2024-11-24 14:25:40 -05:00
Haris Khan
ca4a7a13ea experimental functions, tests pass 2024-11-23 23:54:01 -05:00
Haris Khan
0b0753cac1 tweaks 2024-11-23 22:48:58 -05:00
Haris Khan
40c2c4806c fix padding + fail on invalid padding instead of warn. 2024-11-23 22:45:32 -05:00
eyedeekay
9e3c8bcb98 move logger out of go-i2p so we can re-use it without importing the entire module 2024-11-21 17:16:48 -05:00
Haris Khan
9b4bf2663d clear artifact 2024-11-21 14:25:39 -05:00
eyedeekay
4a6f49d14a NTCP: fix IV functions 2024-11-20 16:02:14 -05:00
eyedeekay
5d789973b2 DRY: use obfs library to ofuscate and deobfuscate ephemeral keys 2024-11-20 15:55:07 -05:00
eyedeekay
08127861f1 Refactor: Fix constants. 2024-11-20 15:37:44 -05:00
eyedeekay
0e6ffd856b Refactor: move Compose* onto the NoiseSession struct. Fix constants. 2024-11-20 15:34:48 -05:00
idk
10daacbc9b Merge pull request #28 from satk0/add-lease-tests
Add lease tests and make names more clear
2024-11-20 17:36:07 +00:00
satk0
eeb1e215a5 Add lease tests and make names more clear 2024-11-19 17:31:34 +01:00
Haris Khan
08e599e59a create Ed25519PublicKeyFromBytes 2024-11-18 12:34:03 -05:00
Haris Khan
30f5565217 .Type -> .Type() 2024-11-18 12:27:55 -05:00
Haris Khan
fc3ba17af5 ReadKeysAndCert is not working as expected 2024-11-18 12:25:31 -05:00
Haris Khan
631f8d1850 nuked lease_set_test.go -> BROKEN 2024-11-17 23:04:07 -05:00
Haris Khan
cc43160bb9 nuked & revived router_info_test.go
-TestRouterInfoCapabilities() fails
-TestRouterInfoVersion() fails
2024-11-17 22:23:31 -05:00
Haris Khan
09acf3d23d adjusted router_info2_test.go 2024-11-17 22:04:27 -05:00
Haris Khan
cbe4af8459 added AsDestination() 2024-11-17 21:44:32 -05:00
Haris Khan
b72ed0a37d remove recovery attempt in mapping 2024-11-17 21:39:31 -05:00
Haris Khan
07268df720 CRITICAL: Reverted mapping.go 2024-11-17 21:03:42 -05:00
Haris Khan
def8789b77 verification 2024-11-17 14:13:38 -05:00
Haris Khan
59c53bc5c1 Added constructors and readers
-NewLeaseSet()
-NewLeaseSetFromBytes()
-ReadLease()
-NewLeaseFromBytes()
2024-11-17 14:00:41 -05:00
Haris Khan
ee56e0f40f corrected TestPublicKeyWithBadCertificate that had fault error matching 2024-11-17 13:32:08 -05:00
Haris Khan
4e2b55ccbe add new tests to router_info.mk 2024-11-17 13:01:46 -05:00
Haris Khan
64d90a157c Fixed array bounds error in handling short input in NewKeyCertificate 2024-11-17 12:55:34 -05:00
Haris Khan
3acff32f17 adjusted vars, all tests pass for mapping 2024-11-17 12:36:26 -05:00
Haris Khan
362513bbe5 Handle extra bytes beyond mapping length 2024-11-17 12:32:46 -05:00
Haris Khan
c9f3227116 added length check to ReadMapping 2024-11-17 12:23:21 -05:00
Haris Khan
f0702ffba9 Various changes
-we're dropping errors instead of trying to recover
-revamp TestReadI2PStringErrWhenDataTooShort to reflect drops instead of recoveries
2024-11-17 11:52:47 -05:00
Haris Khan
11b9018630 implement uniform errors 2024-11-17 11:26:02 -05:00
Haris Khan
f6daa5d9b6 Various changes
-in func (str I2PString) Data(): remove recovery attempts causing tests to fail
-added more universal errors
2024-11-17 11:16:43 -05:00
Haris Khan
58d1f0d815 fixed func (str I2PString) Data()
-replace actual length expected by TestI2PStringDataReportsExtraDataError, which is an invalid length
-added note to see if we should trim instead
2024-11-17 10:52:47 -05:00
Haris Khan
62ececf102 fixed func(str I2pString) Length()
-Previously incorrectly checked length causing TestI2PStringReportsExtraDataError to fail
2024-11-17 10:35:22 -05:00
idk
1d90db3239 Merge pull request #23 from hkh4n/routerinfo
Routerinfo
2024-11-17 14:28:44 +00:00
idk
f729bda62d Merge branch 'master' into routerinfo 2024-11-16 18:17:10 +00:00
eyedeekay
4ad0f97bfe Fail-fast switch for logging Logging, format 2024-11-16 13:15:33 -05:00
idk
e296441f29 Merge branch 'master' into routerinfo 2024-11-16 03:56:57 +00:00
Haris Khan
62086c7d04 make fmt 2024-11-15 22:52:17 -05:00
Haris Khan
ddba94d6ae remove printing 2024-11-15 22:48:57 -05:00
Haris Khan
767b91df49 clean up temp dirs 2024-11-15 22:47:36 -05:00
Haris Khan
1292098cf0 Merge remote-tracking branch 'origin/10k' into 10k 2024-11-15 22:45:04 -05:00
eyedeekay
24bc4c3c17 Implemented ed25519 SPK's 2024-11-15 22:29:42 -05:00
Haris Khan
81eb270351 !WIP! - 10k test 2024-11-15 22:06:23 -05:00
eyedeekay
b6f197cf92 This is not correct yet, work on key_certificate.go lines 216-245 2024-11-15 17:35:44 -05:00
eyedeekay
c10d98a3b2 export DEBUG_I2P=debug in Makefile so that extended logs show up in the tests 2024-11-15 16:52:37 -05:00
Haris Khan
6d16ca5f87 debugging info to investigate 2024-11-15 14:43:36 -05:00
Haris Khan
003d6c9ab8 !WIP! - 10k test 2024-11-15 13:53:44 -05:00
Haris Khan
015c4b23e2 pass sigType to NewRouterInfo 2024-11-15 11:49:10 -05:00
Haris Khan
e29c3c7abb formatting + implemented GetSignatureTypeFromCertificate 2024-11-15 11:31:29 -05:00
Haris Khan
6f6291a9f6 bounds checking 2024-11-15 11:31:10 -05:00
Haris Khan
767864d457 corrected order in Bytes() 2024-11-15 11:30:59 -05:00
Haris Khan
0a98236d85 adjusted test 2024-11-15 11:30:40 -05:00
Haris Khan
c1fa63f6ec added sigtype 2024-11-15 11:30:34 -05:00
Haris Khan
a75c275b4c Corrected Bytes()
-TODO: add logging
2024-11-15 11:30:11 -05:00
Haris Khan
d40b3e0cd3 added sig types 2024-11-15 11:14:05 -05:00
Haris Khan
2ee2d77d7c check if data slice is empty 2024-11-15 11:01:06 -05:00
idk
df45c19272 Merge pull request #24 from satk0/fix-key-certificate-tests
Fix key certificate tests
2024-11-14 15:50:16 +00:00
satk0
f6894e9064 Fix PubKeyWithP521 test 2024-11-12 23:54:50 +01:00
satk0
b36ef65a10 Fix test when data is too small 2024-11-11 23:04:21 +01:00
eyedeekay
271cf56ded Fixes the padding generation but the reader still thinks something's wrong 2024-11-10 19:29:07 -05:00
eyedeekay
a29fa0bc03 Output the rest of the key certificate, that would probably help... 2024-11-10 17:15:56 -05:00
eyedeekay
63c48dd3b7 log the actual bytes in the test for now, make sure they're really there 2024-11-09 13:41:19 -05:00
eyedeekay
8bec47efd2 log the actual bytes in the test for now, make sure they're really there 2024-11-09 13:39:38 -05:00
eyedeekay
69a50e2035 Try adding a dummy address, change logging to show where not enough data was provided 2024-11-09 13:33:23 -05:00
eyedeekay
8319444890 Try adding a dummy address, change logging to show where not enough data was provided 2024-11-09 13:31:24 -05:00
eyedeekay
b378661e0e Fix LS test, update Noise Subsystem on README.md 2024-11-09 12:33:53 -05:00
Haris Khan
f4086e5f68 !WIP! - Router Info 2024-11-09 11:13:48 -05:00
Haris Khan
877fc707c4 !WIP! - Router Info 2024-11-09 01:04:44 -05:00
Haris Khan
98d05e27c8 !WIP! - Router Info 2024-11-09 00:53:17 -05:00
eyedeekay
8c2b952616 setup auto-assign workflow 2024-11-08 15:01:05 -05:00
eyedeekay
4020db8a19 Refactor: Certificate Constructor: 2024-11-04 19:19:03 -05:00
eyedeekay
67a02f5d69 Noise: Refactor, remove unused fields 2024-11-04 18:26:17 -05:00
eyedeekay
ca1280231c Tidy 2024-11-04 15:25:54 -05:00
eyedeekay
02b309df43 Refactor: move HandshakeState to own struct in preparation for NTCP2 mods 2024-11-04 15:20:56 -05:00
eyedeekay
a5b3c3f194 NTCP2: Stub out NTCP2 and explain the task at hand, SSU2: Explain the plan 2024-11-04 00:24:08 -05:00
eyedeekay
0aa7a5554b Merge branch 'master' of github.com:go-i2p/go-i2p 2024-11-03 23:59:13 -05:00
eyedeekay
266a1b71d6 Cleanup: Move obfs.go to own package to avoid import cycle noise->ntcp. I probably should have caught that in review. 2024-11-03 23:58:49 -05:00
idk
d32f2e78ab Merge pull request #21 from hkh4n/config
move base dir from ~/go-i2p to ~/.go-i2p & other changes
2024-11-04 04:51:24 +00:00
idk
9e806bc32e Merge branch 'master' into config 2024-11-03 22:25:05 +00:00
idk
c52112a36f Merge pull request #22 from hkh4n/refactor
go mod tidy & fixed condition that was always true
2024-11-03 22:23:15 +00:00
eyedeekay
db0fd9f7e9 Management: rm PASTA.md 2024-11-03 15:53:23 -05:00
eyedeekay
3ab258cde6 Management: add ROADMAP.md 2024-11-03 15:53:13 -05:00
Haris Khan
20b9bbd8e4 go mod tidy & fixed condition that was always true 2024-11-03 01:52:48 -05:00
Haris Khan
1fa520613c replace deprecated function (ioutil -> os) 2024-11-03 00:14:45 -04:00
Haris Khan
fb99b98a7e minor typo fix 2024-11-02 21:37:56 -04:00
Haris Khan
d6b8cd9d4d go mod tidy 2024-11-02 21:37:29 -04:00
Haris Khan
92e4656774 move from ~/go-i2p to ~/.go-i2p 2024-11-02 21:37:23 -04:00
Haris Khan
5f2bfb8d9d gofumpt adjustment 2024-11-02 21:36:55 -04:00
idk
9494c226a6 Merge pull request #19 from go-i2p/noise-experimental
Noise Subsystem
2024-11-02 02:59:43 +00:00
idk
344edc6d41 Merge branch 'master' into noise-experimental 2024-11-02 02:59:24 +00:00
idk
9eea99b489 Merge pull request #20 from hkh4n/noise-experimental
Polishes
2024-11-01 14:30:25 +00:00
idk
c984f94b90 Merge pull request #9 from hkh4n/sntp-experimental
Implemented mimic implementation of sntp from the original java implementation
2024-11-01 14:28:00 +00:00
Haris Khan
a17f0208dd gofumpt adjustment 2024-10-31 10:53:22 -04:00
Haris Khan
487815f8f1 tests 2024-10-31 10:50:21 -04:00
Haris Khan
24e0baa879 Moved functions
-encryptPacketDeux -> testEncryptPacket in encrdecr_packet_test.go
-decryptPacketDeux -> testDecryptPacket in encrdecr_packet_test.go
2024-10-31 10:45:42 -04:00
Haris Khan
a5d2f0de8c lib/transport/noise/doc.md 2024-10-31 00:01:22 -04:00
Haris Khan
423f616d53 Info -> Debug 2024-10-30 23:29:46 -04:00
idk
c65048f3c4 Merge pull request #18 from hkh4n/config
Added config
2024-10-30 22:03:24 +00:00
Haris Khan
39b683dac8 fixed circular dependency 2024-10-30 11:20:15 -04:00
Haris Khan
46883f6457 build fails -> import cycle 2024-10-30 09:31:01 -04:00
Haris Khan
4be55062fc Moved config funcs to config.go 2024-10-30 09:22:32 -04:00
Haris Khan
12a3fd4623 Added config files + args
-added routerInstance
-added initConfig()
-added updateRouterConfig()
-yaml format
2024-10-30 09:16:22 -04:00
eyedeekay
80e539930e Mapping: fix off-by-one. Format: gofumpt 2024-10-28 18:11:54 -04:00
Haris Khan
e58d326d89 Move obfuscation functions to lib/transport/ntcp 2024-10-25 21:29:02 -04:00
Haris Khan
e6f84c16f6 added experimental functions which factor in packet length
-encryptPacketDeux
-decryptPacketDeux

Added test -> TestEncryptDecryptPacketObfsOfflineWithFunc()

added new functions in aes.go
-EncryptNoPadding
-DecryptNoPadding
2024-10-24 22:57:36 -04:00
Haris Khan
971a18de8d added Compatible warning message 2024-10-24 19:23:36 -04:00
Haris Khan
833836ae67 added TestEncryptDecryptPacketObfsOffline 2024-10-24 18:58:07 -04:00
Haris Khan
3f191db37a implement TODO for Compatible in NoiseTransport 2024-10-24 18:03:20 -04:00
idk
6865bae386 Merge pull request #17 from hkh4n/dirs
create ~/go-i2p and ~/go-i2p/config properly
2024-10-24 20:12:06 +00:00
Haris Khan
f0d9f89ed9 Mkdir -> MkdirAll 2024-10-24 14:26:51 -04:00
idk
c149eef1de Merge pull request #15 from hkh4n/makefile
Makefiles for tests + hotfix for logging naming convention
2024-10-23 17:34:06 +00:00
Haris Khan
748dc8a66f tweaks 2024-10-23 00:11:46 -04:00
Haris Khan
677aac500e fix logger naming collision with other libs 2024-10-23 00:06:06 -04:00
Haris Khan
4e06d3d5ed makefiles 2024-10-22 22:31:19 -04:00
Haris Khan
5eaa9cf588 log name collision fix 2024-10-22 22:10:14 -04:00
Haris Khan
4dbf537e94 log name collision fix 2024-10-22 22:07:39 -04:00
Haris Khan
882c018c0c log name collision fix 2024-10-22 22:06:06 -04:00
Haris Khan
5432502852 typo correction 2024-10-22 21:43:49 -04:00
idk
0ea5743365 Merge pull request #14 from hkh4n/noise-experimental
gofumpt adjustment
2024-10-22 21:53:24 +00:00
Haris Khan
a9dc482bda gofumpt 2024-10-22 17:37:17 -04:00
idk
c31d20fec0 Merge pull request #13 from hkh4n/logging
Logging
2024-10-22 18:55:15 +00:00
Haris Khan
647546a374 typo fix 2024-10-22 14:51:17 -04:00
Haris Khan
e468520906 Merge branch 'master' into sntp-experimental 2024-10-20 00:09:42 -04:00
Haris Khan
ade80e577c added sntp verification
-Leap Indicator
-Stratum level check
-Round-trip Delay
-Clock offset
-simple non-zero time
-Root Dispersion and Root Delay
2024-10-20 00:07:40 -04:00
Haris Khan
f45d301868 proposed refactor
-added secureRandBool() and performTimeQuery()
2024-10-19 22:17:10 -04:00
Haris Khan
0256908395 CRITICAL FIX, bytesRead -> n.
n wasn't being used before
2024-10-19 17:27:39 -04:00
Haris Khan
3c5aa206d1 expanded logging in message.go 2024-10-19 12:32:49 -04:00
Haris Khan
a4517cafd7 expanded logging in delivery.go 2024-10-19 12:25:31 -04:00
Haris Khan
f4f39ca53c expanded logging in multi.go 2024-10-19 11:18:20 -04:00
Haris Khan
220159476a expanded logging in write_session.go 2024-10-19 11:09:37 -04:00
Haris Khan
792cd49208 expanded logging in transport.go 2024-10-19 11:03:55 -04:00
Haris Khan
68051630c0 expanded logging in session.go 2024-10-19 10:55:30 -04:00
Haris Khan
a3340eb40a expanded logging in read_session.go + changed structure in readPacketLocked() 2024-10-19 10:50:13 -04:00
Haris Khan
465a7787a9 expanded logging in outgoing_handshake.go 2024-10-19 10:44:08 -04:00
Haris Khan
af3bc44dba expanded logging in incoming_handshake.go 2024-10-19 10:39:23 -04:00
Haris Khan
f850f482cf expanded logging in handshake.go 2024-10-19 10:30:11 -04:00
Haris Khan
3f23376d22 expanded logging in su3.go 2024-10-19 10:19:55 -04:00
Haris Khan
aa98589f1c expanded logging in router.go 2024-10-19 09:46:23 -04:00
Haris Khan
c31e990995 expanded logging in std.go 2024-10-18 23:06:44 -04:00
Haris Khan
8e97eb5f77 expanded logging in reseed.go 2024-10-18 22:54:08 -04:00
Haris Khan
be35267079 expanded logging in header.go 2024-10-18 22:47:28 -04:00
Haris Khan
013d35b447 expanded logging in build_request_record.go 2024-10-18 22:41:40 -04:00
Haris Khan
e8c9dc17a3 expanded logging in tunnel.go 2024-10-18 21:58:50 -04:00
Haris Khan
a1d574446b expanded logging in elg.go 2024-10-18 21:54:27 -04:00
Haris Khan
8680acc595 expanded logging in ed25519.go 2024-10-18 21:42:07 -04:00
Haris Khan
84e3c5accc expanded logging in ecdsa.go 2024-10-18 17:01:42 -04:00
Haris Khan
e772fb5ceb expanded logging in dsa.go 2024-10-18 16:56:25 -04:00
Haris Khan
a533cd7ce4 expanded logging in curve25519.go 2024-10-18 16:39:28 -04:00
Haris Khan
df37d49444 expanded logging to aes.go 2024-10-18 15:10:16 -04:00
Haris Khan
4b2600a065 expanded logging to signature.go
-changed sessionTag -> sig
2024-10-18 14:55:30 -04:00
Haris Khan
1c4f937002 expanded logging to session_tag.go 2024-10-18 14:51:53 -04:00
Haris Khan
5c2b408f65 expanded logging to session_key.go 2024-10-18 14:43:59 -04:00
Haris Khan
beb533a09b expanded logging to router_info.go 2024-10-18 14:40:52 -04:00
Haris Khan
f022522ad5 expanded logging to router_identity.go 2024-10-18 14:27:41 -04:00
Haris Khan
2191c40ac6 expanded logging to router_address.go + gofumpt adjustment 2024-10-18 13:22:36 -04:00
Haris Khan
3bca467f28 updated README.md to reflect new logging paradigm. 2024-10-18 12:59:49 -04:00
Haris Khan
a2fd65ee32 expanded logging in lease_set.go 2024-10-18 12:55:35 -04:00
Haris Khan
b894e8fb17 expanded logging in keys_and_cert.go 2024-10-18 12:41:48 -04:00
Haris Khan
93a71c7398 expanded logging in key_certificate.go 2024-10-18 12:27:42 -04:00
Haris Khan
b6544ad194 expanded logging in destination.go 2024-10-18 12:16:36 -04:00
Haris Khan
a72b61a886 expanded logging in string.go 2024-10-18 12:08:27 -04:00
Haris Khan
dda4f90b6f expanded logging in mapping_values.go 2024-10-18 12:00:58 -04:00
Haris Khan
1d1d8126c2 adjusted logging in main.go 2024-10-18 11:53:01 -04:00
Haris Khan
73db39ae50 expanded logging in mapping.go 2024-10-18 11:52:39 -04:00
Haris Khan
53e902f491 expanded logging to date.go 2024-10-18 11:49:10 -04:00
Haris Khan
2f2cd2249c expanded logging to certificate.go 2024-10-18 11:48:56 -04:00
Haris Khan
4496c11394 added lib/util/logger/log.go 2024-10-17 22:03:46 -04:00
idk
69449a20b5 Merge pull request #12 from hkh4n/crypto2
AES
2024-10-17 23:48:13 +00:00
Haris Khan
a7689e801a minor typo 2024-10-06 12:13:04 -04:00
Haris Khan
278bdee277 Various changes
-Aes -> AES
-doc.md
2024-10-06 10:48:22 -04:00
Haris Khan
684e89c957 minor typo 2024-10-05 10:15:31 -04:00
Haris Khan
50fa9fc374 gofumpt adjustment 2024-10-05 09:43:58 -04:00
Haris Khan
491b25022e AES
-Revamped encrypt and decrypt to fit with interfaces
-Adjusted test cases for TestPKCS7UnpadInvalidInput()
2024-10-05 09:00:33 -04:00
Haris Khan
677a6b354b AES test 2024-10-04 22:37:57 -04:00
Haris Khan
9469fd83aa AES 2024-10-04 22:36:32 -04:00
idk
8173ae49e6 Merge pull request #10 from hkh4n/makefile
Added gofumpt check
2024-10-04 03:26:01 +00:00
Haris Khan
2f109d5b4d Added gofumpt check 2024-10-03 23:24:12 -04:00
eyedeekay
d7378d7b08 more merge conflicts 2024-10-03 22:46:39 -04:00
eyedeekay
3a51a1229e more merge conflicts 2024-10-03 22:45:33 -04:00
eyedeekay
2b18b2941d resolve merge conflicts in lib/transport/noise 2024-10-03 22:42:00 -04:00
eyedeekay
1eb29ec4ab formatting issues only 2024-10-03 22:36:23 -04:00
eyedeekay
d900d7faf8 add doc.md files from master 2024-10-03 22:10:55 -04:00
eyedeekay
03c9d60ab9 update other non-transport parts of lib 2024-10-03 22:09:16 -04:00
eyedeekay
de2caf499e use makefile from Master 2024-10-03 21:58:16 -04:00
eyedeekay
284dd7287e use makefile from Master 2024-10-03 21:56:58 -04:00
eyedeekay
9f4154ff45 gofmt 2024-10-03 21:55:35 -04:00
eyedeekay
08a0d92742 gofmt 2024-10-03 21:52:49 -04:00
eyedeekay
524526d946 Bring in crypto stubs from master 2024-10-03 21:41:31 -04:00
eyedeekay
09c7d32797 update the common library to the master branch 2024-10-03 21:31:54 -04:00
Haris Khan
16961abc96 !WIP!
-added error handling in TestTransport()
-fixed typo to ComposeReceiverHandshakeMessage
-experimental implementation of encryptPacket
-added encrdecr_packet_test.go
2024-10-03 19:45:17 -04:00
Haris Khan
8fa355f067 !WIP! router_timestamper 2024-09-29 22:03:30 -04:00
eyedeekay
0c7a3f0f22 force static builds for slightly easier debugging 2024-09-09 20:13:20 -04:00
eyedeekay
3d535f67a1 Work on curve25519 stuff so I can generate my own routerInfos instead of just sending crap to other people 2024-09-09 20:10:38 -04:00
eyedeekay
bba9350506 WOO some of the important fields are actually populated with correct values 2024-08-28 20:47:54 -04:00
eyedeekay
cbc0de4e7e Start working on de-obfuscating ephemeral keys from remote peers 2024-08-28 18:32:42 -04:00
eyedeekay
310ef07d3c generate godoc locally so I can go over it offline 2024-08-26 16:21:54 -04:00
eyedeekay
14fc6fc3a8 Work on noise tools, comment details of handshake stuff 2024-08-25 23:22:21 -04:00
eyedeekay
a3ce9d36c6 If string data is shorter than specified by length create a new string based on the content after the first byte 2024-07-08 10:46:16 -04:00
eyedeekay
58a43cdfaf Fix string length checks, sortof 2024-07-05 23:12:03 -04:00
eyedeekay
15a5ca5daf Try and make noise work and also fix some tests 2024-07-05 18:12:58 -04:00
eyedeekay
08a41686b6 Work on noise wrapper. It is now good enough to fail to connect to a remote I2P router in a way which is discernible on that remote router. 2024-07-03 01:19:31 -04:00
eyedeekay
8318fd8f57 Work on noise wrapper. It is now good enough to fail to connect to a remote I2P router in a way which is discernible on that remote router. 2024-07-03 01:17:36 -04:00
eyedeekay
9c0552e236 Make some netDb loading stuff work so I have RI's to talk to 2024-07-02 16:54:30 -04:00
eyedeekay
20b018a708 Make some netDb loading stuff work so I have RI's to talk to 2024-07-02 16:53:57 -04:00
eyedeekay
6c62faa49b finish stubbing out noise transport stuff 2024-07-01 21:37:05 -04:00
eyedeekay
a7e31b7833 implement more noise stuff 2024-07-01 21:34:09 -04:00
eyedeekay
c09161c824 check in beginnings of new cleaned-up noise prototype 2024-07-01 18:50:13 -04:00
eyedeekay
aca62174e6 Load RI's into netDb struct for later referencing 2024-06-30 23:14:48 -04:00
eyedeekay
bd27f00959 add my unzip fork which fixes the permissions bug 2024-06-29 00:36:11 -04:00
eyedeekay
05c4d3d973 add my unzip fork which fixes the permissions bug 2024-06-29 00:25:23 -04:00
eyedeekay
40d0ea5ff5 Start making it so I can configure things, so I can configure it to read the netDb I already have and attempt to make a connection. Implement a reseed puller, or at least most of one. 2024-06-29 00:23:55 -04:00
eyedeekay
58e8f78c56 Start making it so I can configure things, so I can configure it to read the netDb I already have and attempt to make a connection. Implement a reseed puller, or at least most of one. 2024-06-29 00:23:42 -04:00
eyedeekay
ac705dee76 Set up a pre-release 2024-06-25 12:04:18 -04:00
eyedeekay
ca0443ae6a Set up a pre-release 2024-06-25 12:03:55 -04:00
eyedeekay
94d0d8efb7 Set up a pre-release 2024-06-25 12:03:09 -04:00
eyedeekay
8176e126cb Set up a pre-release 2024-06-25 12:02:49 -04:00
eyedeekay
992c5537db Set up a pre-release 2024-06-25 12:02:11 -04:00
eyedeekay
5ff9f5578e Update notes 2024-06-25 11:57:52 -04:00
eyedeekay
889ec939b3 Eliminate superfluous/rules-breaking logging 2024-06-25 11:41:55 -04:00
eyedeekay
6e3a5923cd Make MAX_GOOD_VERSION 99(0.9.99) 2024-06-25 09:35:39 -04:00
eyedeekay
ce25a2f0fb Add functions to examine caps 2024-06-24 22:26:17 -04:00
eyedeekay
ec22860bb5 Add Get function to MappingValues 2024-06-24 22:18:13 -04:00
eyedeekay
cefdcd8c14 RI parsing works again with options and caps and everything 2024-06-24 21:18:54 -04:00
eyedeekay
d519f7678d make logging clearer 2024-06-23 22:48:15 -04:00
eyedeekay
8dfc5ee5b8 Fix some string errors 2024-06-23 22:39:11 -04:00
eyedeekay
d8317351cf Write down my TODO thing 2024-06-23 03:41:40 -04:00
eyedeekay
ef127d81c1 Work on figuring out why the mapping size disagrees with the bytes 2024-06-23 03:24:57 -04:00
eyedeekay
8acfba160f Log some of the errors that came up after I fix the remainder emissions 2024-06-23 02:51:48 -04:00
eyedeekay
d93e78d772 Fix how it handles remainders of structures when parsing routerInfos 2024-06-23 01:35:42 -04:00
eyedeekay
bdc9ca4c2b Implement some missing ed25519 functions 2024-06-20 17:04:21 -04:00
eyedeekay
83f3d11621 Update the roadmap to more accurately reflect the actual state of the code 2024-02-09 15:02:46 -05:00
eyedeekay
784f72403b Fix padding, add TODO note, align spk to end of first 384 bytes 2024-02-05 12:41:49 -05:00
eyedeekay
664a17e42a Fix construction of keys_and_cert from a stream of bytes 2024-02-05 12:32:33 -05:00
eyedeekay
37718c36f8 Fix cert construction in keys_and_cert 2024-02-05 11:47:51 -05:00
eyedeekay
b0fcf4bc11 Fix mapping values, remove redundant, unused functions 2024-02-05 10:42:57 -05:00
idk
65febb5dcf Work on organizing this Noise over TCP Socket stuff 2022-12-15 23:52:05 +00:00
idk
116e22f8da Try to figure out how to implement the pieces I'm still missing from the Noise handshake, but I think that I probably need to redo it again anyway 2022-12-12 17:44:43 +00:00
idk
0419665d7b use separate incoming and outgoing queues 2022-11-14 00:10:58 -05:00
idk
dab108c270 Client=>Outgoing 2022-11-13 23:46:57 -05:00
idk
0fcded4c51 check in more noise handshake missing pieces 2022-11-13 22:24:31 -05:00
idk
7d16b0b257 update my notes 2022-10-17 02:16:44 -04:00
idk
a689f26d73 fix merge conflicts 2022-10-17 02:07:11 -04:00
idk
8d631239b7 Implements a mostly-working Noise IK handshake on a socket with multiple subsessions. Does not implement conns or listeners yet. 2022-10-17 02:03:59 -04:00
idk
fdc34b382e Fix some tests so it compiles again 2022-10-16 17:19:38 -04:00
idk
a4ed06e530 update my notes 2022-09-26 12:18:33 -04:00
idk
c6e359f152 Merge pull request #4 from Thuulium/MappingValues/TweakValuesSort
Rework MappingValues Sort
2022-09-20 11:14:51 -04:00
thulium
70415b34eb Tweak test message 2022-09-19 19:47:46 -04:00
thulium
dbd4c7d346 Allow duplicate keys, add back HasDuplicateKeys 2022-09-19 19:46:46 -04:00
idk
6b5ea57cbd Move my noise transport tests to a branch so I don't mess up the other branch 2022-09-19 14:35:49 -04:00
thulium
43c3498389 Rework MappingValues Sort 2022-09-18 20:54:43 -04:00
idk
f90d1d5f42 Merge branch 'tweak-lib/common-godocs' into 'master'
Tweak godocs for lib/common

See merge request idk/go-i2p!4
2022-09-19 00:02:56 +00:00
thulium
c8c4196c6f Tweak godocs for lib/common 2022-09-12 04:31:02 -04:00
idk
68a6ed02be Merge branch 'unbreak-mappings' into 'master'
Attempt to fix mappings

See merge request idk/go-i2p!3
2022-09-11 19:13:49 +00:00
thulium
53dd3230df Attempt to fix mappings 2022-09-10 15:34:20 -04:00
idk
c3147c3570 Fix most of the router info tests, all errors are now Mapping-related. 2022-08-06 14:16:42 -04:00
idk
76fba3c8ba Merge pull request #3 from apeace/su3
This merges apeace's working SU3 implementation, which is more like idiomatic Go and will be easier to build upon. TODO: We need to write the godoc, we don't want that situation to get out of hand.
2022-08-05 00:55:57 -04:00
apeace
0cae80c698 documentation on novg.net reseed file 2022-08-03 16:14:21 -04:00
apeace
7deba5f725 when checking su3 signature, hash ALL file contents up to the signature 2022-08-03 16:10:27 -04:00
apeace
35983423ed update from PSS -> PKCS1v15 2022-08-02 15:46:06 -04:00
apeace
136133e643 add signature test for snowflake plugin 2022-08-02 11:50:02 -04:00
apeace
8d39f1512a add su3 test of snowflake plugin 2022-08-02 11:43:54 -04:00
apeace
c9b5fa1406 Add a test for verifying i2pgit reseed signature 2022-08-02 11:27:45 -04:00
apeace
cdc9998f10 improve su3 tests by only generating fake data once 2022-08-02 09:47:19 -04:00
apeace
4c06fcaff0 add su3 documentation on streaming to disk 2022-08-02 09:47:19 -04:00
apeace
403ef30119 verify su3 RSA signatures 2022-08-02 09:47:19 -04:00
apeace
feef6e6bbf refactor su3 readers to support signature verification 2022-08-02 09:47:19 -04:00
apeace
ad7a828d43 documentation on reading su3 from []byte 2022-08-02 09:47:19 -04:00
apeace
416cf6546a remove unused config/su3 implementation 2022-08-02 09:47:19 -04:00
apeace
9b81a5c6d8 package su3 documentation 2022-08-02 09:47:19 -04:00
apeace
940347351e package su3 documentation 2022-08-02 09:47:19 -04:00
apeace
726bff974c read SU3 files into io.Readers 2022-08-02 09:47:19 -04:00
apeace
74591a96cb read SU3 files into a struct 2022-08-02 09:47:19 -04:00
idk
eb117aa1bd Updates Go Modules and several tests.
Re: the tests, this happens largely because when you can check for errors changes fundamentally
based on whether or not you're just reading some bytes and storing them for later or whether
you're reading them and then immediately trying to store them in some intelligible datastructure.
The old code, before I started refactoring it, sort of split the difference by putting everything
into slices of bytes, but hanging functions off those byte slices to parse intellible structures
on the fly. The tests were largely designed around testing this format. Updating them has been
a menace. It is very difficult to tell which tests are necessary and how the necessary tests need
to be changed. A handful of high-level tests in router_info_test currently won't compile. I think
those are the only remaining broken tests.
2022-08-01 12:50:42 -04:00
idk
88d8d09527 write my notes for this week 2022-07-18 13:31:20 -04:00
idk
83e999992f start putting my copypasta in the repo 2022-07-18 12:48:49 -04:00
idk
a437bab373 Progress on pure-noise transport 2022-07-18 12:32:29 -04:00
idk
2d310fe91a Progress on pure-noise transport 2022-07-18 12:32:16 -04:00
idk
fefbfc4be6 move mapping_values to it's own file 2022-07-14 16:05:48 -04:00
idk
0ec4f55fa9 Check in unchecked-in common library fixes, start implementing transports.
Since I turned out to be implementing parts of Noise which I did not need to implement, I'm taking a different approach, and doing an unmodified Noise transport first and then making our modifications to it. That should reduce what I need to do to message pre-processing mostly, I think.
2022-07-11 23:41:58 -04:00
idk
8bd30d1e23 start pure-noise transport. Move messages to own module 2022-07-11 17:29:01 -04:00
idk
b7768d4d99 Work on Mapping tests, get ready to send Session messages for NTCP2 2022-07-11 10:33:33 -04:00
idk
171f09bba6 move every struct into it's own directory in order to run tests individually. 2022-05-22 19:59:20 -04:00
idk
13b996d0da Factor away byte slices in RouterInfo, KeysAndCert, Mapping, RouterAddress, RouterIdentity. 2022-05-09 20:43:24 -04:00
idk
82f0e86931 refactor Strings, Integers, Dates, Mapping, Certificates and KeyCertificates. The remaining structs will be checked in one-by-one. 2022-05-02 14:24:51 -04:00
idk
f113977419 refactor certs, keycerts 2022-04-27 10:50:10 -04:00
idk
86dc323348 refactor certs, keycerts 2022-04-27 10:48:59 -04:00
idk
a80c9973f9 Merge pull request #1 from eyedeekay/circleci-project-setup
Add .circleci/config.yml
2021-05-11 10:46:52 -07:00
idk
7adf3d7577 Add .circleci/config.yml 2021-05-11 07:34:35 -07:00
idk
42be0d6b5c Merge pull request #1 from kpetku/drop-libsodium-dep
remove libsodium dependency in favor of the native go/crypto ed25519 library
2021-05-07 20:07:10 -07:00
d837630ff6 remove libsodium dependency in favor of the native go/crypto ed25519 library 2021-05-07 21:02:54 -04:00
idk
590d576b74 Merge branch 'checklist' into 'master'
Checklist update: Add items, remove NTCP 1

See merge request idk/go-i2p!1
2021-04-27 14:10:02 +00:00
zzz
fa86f8e3b3 Checklist update: Add items, remove NTCP 1 2021-04-27 10:03:52 -04:00
321 changed files with 19973 additions and 6786 deletions

26
.circleci/config.yml Normal file
View File

@@ -0,0 +1,26 @@
# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
jobs:
build:
working_directory: ~/repo
docker:
- image: circleci/golang:1.15.8
steps:
- checkout
- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}
- run:
name: Install Dependencies
command: go mod download
- save_cache:
key: go-mod-v4-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- run:
name: Run tests
command: |
mkdir -p /tmp/test-reports
gotestsum --junitfile /tmp/test-reports/unit-tests.xml
- store_test_results:
path: /tmp/test-reports

19
.github/workflows/auto-assign.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Auto Assign
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
run:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: 'Auto-assign issue'
uses: pozil/auto-assign-issue@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
assignees: eyedeekay
numOfAssignee: 1

60
.github/workflows/page.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: Generate and Deploy GitHub Pages
on:
# Run once hourly
schedule:
- cron: '0 * * * *'
# Allow manual trigger
workflow_dispatch:
# Run on pushes to main branch
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper repo data
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.x'
cache: true
- name: Build Site Generator
run: |
go install github.com/go-i2p/go-gh-page/cmd/github-site-gen@latest
export GOBIN=$(go env GOPATH)/bin
cp -v "$GOBIN/github-site-gen" ./github-site-gen
# Ensure the binary is executable
chmod +x github-site-gen
- name: Generate Site
run: |
# Determine current repository owner and name
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 1)
REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2)
# Generate the site
./github-site-gen -repo "${REPO_OWNER}/${REPO_NAME}" -output ./site
# Create a .nojekyll file to disable Jekyll processing
touch ./site/.nojekyll
# Add a .gitattributes file to ensure consistent line endings
echo "* text=auto" > ./site/.gitattributes
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: site # The folder the action should deploy
branch: gh-pages # The branch the action should deploy to
clean: true # Automatically remove deleted files from the deploy branch
commit-message: "Deploy site generated on ${{ github.sha }}"

62
.github/workflows/tests.yml vendored Normal file
View File

@@ -0,0 +1,62 @@
name: Go Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- run: make build
env:
GO: go
CGO_ENABLED: 0
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21' # Adjust this version as needed
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install gofumpt
run: go install mvdan.cc/gofumpt@latest
- name: Go mod tidy
run: go mod tidy
- name: Run all tests
run: go test -v ./...
env:
GO: go
DEBUG_I2P: debug
CGO_ENABLED: 0
- name: Upload Test Logs
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.test_target }}-logs
path: ./test-logs/${{ matrix.test_target }}.log # Adjust this path as needed

8
.gitignore vendored
View File

@@ -5,4 +5,10 @@
*.coverprofile
*exportable-fuzz.zip
go-i2p
*.exe*.log
*.exe
.idea/
router.info
log
*.gv
diff
err

9
.vscode/launch.json vendored
View File

@@ -1,9 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
]
}

View File

@@ -1,21 +1,35 @@
# Contributing
Thanks for taking a look at go-i2p! Please reach out if you have any questions or need help getting started.
Thanks for taking a look at go-i2p! Please reach out if you have any questions or need help getting started. We have an IRC channel on IRC2P: #go-i2p-dev and we're reachable here at github.com/go-i2p also.
## Getting Starting
## Getting Started
Install required dependencies
This example assumes Ubuntu 16.04
This example assumes Ubuntu or Debian based Linux, a reasonably modern version.
The instructions will be similar for other Linux distributions with slightly different package managers and package names.
```sh
sudo apt-get install pkg-config libsodium-dev
go get github.com/hkparker/go-i2p
go get github.com/Sirupsen/logrus
go get github.com/stretchr/testify/assert
# For obtaining, modifying, compiling, and tracking changes to go-i2p, install:
sudo apt-get install golang-go make git
# If you want to generate markdown versions of the godoc locally, also install:
go install github.com/robertkrimen/godocdown/godocdown@master
# If you want to generate call graphs locally, also install:
go install github.com/ofabry/go-callvis@master
```
Fork go-i2p and clone it into your workspace. Make sure you can execute `go test ./...` in the project's root directory. At that point you should have everything you need to start making changes and opening pull requests. If you aren't sure what to work on, take a look at some good [getting started issues](https://github.com/hkparker/go-i2p/issues?q=is%3Aopen+is%3Aissue+label%3A%22start+here%22).
On Windows, one must install the latest versions of Go and Git Bash from their respective sources.
## Set up your workspace:
```sh
github_username=yourusername
cd $(go env GOPATH)
git clone git@github.com:$github_username/go-i2p github.com/go-i2p/go-i2p
github.com/go-i2p/go-i2p
```
Fork go-i2p and clone it into your workspace. Make sure you can execute `go test ./...` in the project's root directory. At that point you should have everything you need to start making changes and opening pull requests.
## I2P Specifications
@@ -27,9 +41,17 @@ The I2P community maintains up-to-date [specifications](https://geti2p.net/spec)
## Conventions
#### Errors
We use oops to provide context to the errors we return. Do not use `errors.New` or `fmt.Errorf` when returning errors from functions. Instead, wrap raw errors in oops errors. When an error is recieved, used oops to supplement the log output.
It is OK to use `fmt.Errorf` for declaring custom error types.
#### Logging
Logrus is used for logging across all of go-i2p. All log statements should contain an `at` fields and a `reason` field. Here is a good example from the go-i2p implementation of a LeaseSet:
Logrus is used for logging across all of go-i2p. We have a small extension of logrus at https://github.com/go-i2p/logger which we use to add a "Fail Fast mode." We are mostly converted over to using it.
All log statements should contain an `at` fields and a `reason` field. Here is a good example from the go-i2p implementation of a LeaseSet:
```go
log.WithFields(log.Fields{
@@ -57,4 +79,4 @@ func TestRouterAddressCountReturnsCorrectCount(t *testing.T) {
## Pull Requests
Pull requests should pass all tests, test all new behavior, and be correctly formatted by `gofmt` before merge. Feel free to open incomplete pull requests if you are struggling, I will enthusiasticlly help you complete the PR in any way needed.
Pull requests should pass all tests, test all new behavior, and be correctly formatted by `gofumpt -w -s -extra` before merge. Feel free to open incomplete pull requests and ask for help and advice.

View File

@@ -1,5 +1,9 @@
RELEASE_TAG=0.0.1
RELEASE_VERSION=${RELEASE_TAG}
RELEASE_DESCRIPTION=`cat PASTA.md`
REPO := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CGO_ENABLED=0
export DEBUG_I2P=debug
ifdef GOROOT
GO = $(GOROOT)/bin/go
@@ -13,19 +17,28 @@ else
EXE := $(REPO)/go-i2p
endif
#check for gofumpt
check_gofumpt:
@which gofumpt > /dev/null 2>&1 || (echo "gofumpt is required but not installed. Please install it from https://github.com/mvdan/gofumpt."; exit 1)
build: clean $(EXE)
$(EXE):
$(GO) build -v -o $(EXE)
test:
$(GO) test -failfast ./...
$(GO) build --tags netgo,osusergo -v -o $(EXE)
clean:
$(GO) clean -v
fmt:
find . -name '*.go' -exec gofmt -w -s {} \;
find . -name '*.go' -exec gofumpt -w {} \;
testcommon:
$(GO) test -failfast ./lib/common/...
info:
echo "GOROOT: ${GOROOT}"
echo "GO: ${GO}"
echo "REPO: ${REPO}"
release:
github-release release -u go-i2p -r go-i2p -n "${RELEASE_VERSION}" -t "${RELEASE_TAG}" -d "${RELEASE_DESCRIPTION}" -p
godoc:
./callgraph.sh

198
README.md
View File

@@ -4,106 +4,132 @@ A pure Go implementation of the I2P router.
## Status
go-i2p was in early development. Now it's being restructured in some
fundamental ways, so it's even less done than before(on this branch, for now)
but when this restructuring is complete, it will be a fully-fledged I2P router
and library for writing, embedding, and possiblly extending I2P routers in Go
applications.
The go module is declared as: `github.com/go-i2p/go-i2p`, in order to clone
anonymously you may use `torsocks` with `go get`(YMMV) or you may clone
it from git.idk.i2p using:
#Set your $GOPATH, if it isn't set already then GOPATH=$HOME/go
$GOPATH/go/src/i2pgit.org/idk/
git clone git@127.0.0.1:idk/go-i2p $GOPATH/go/src/github.com/go-i2p/go-i2p
$GOPATH/go/src/github.com/go-i2p/go-i2p
And build with `GO111MODULES=off` or use a `replace` directive in your `go.mod`
to direct to the local module source. Or you may run your own Go Modules proxy as
a hidden service. I'll make this about a billion times easier in the near future I
promise.
go-i2p is in early development. The master branch is being refactored and API's are
definitely going to change. If you choose to use any part of this code right now,
please keep up with these changes, as they will not be backward compatible and require
**Fundamentally** changing any code that treats this as a dependency.
### Implemented Features
As the application is restructured and moved away from representing I2P data
structures as byte slices, this chart will be filled in, when the tests pass,
the item will be checked off. Currently, much of this is partially implemented
in byte-slice versions and partially implemented as Go Structs. Very little of
it will work until it's all moved to Go Structs where appropriate. Most of
this will happen in /lib/common.
- Cryptographic primitives
- Clients
- [ ] Datagrams
- [ ] I2CP
- [ ] Message routing
- [ ] Streaming
- [Cryptographic primitives(see also: https://github.com/go-i2p/crypto)](https://github.com/go-i2p/crypto)
- Signing
- [ ] ECDSA_SHA256_P256
- [ ] ECDSA_SHA384_P384
- [ ] ECDSA_SHA512_P521
- [ ] Ed25519
- [X] ECDSA_SHA256_P256
- [X] ECDSA_SHA384_P384
- [X] ECDSA_SHA512_P521
- [X] Ed25519
- Verifying
- [ ] DSA
- [ ] ECDSA_SHA256_P256
- [ ] ECDSA_SHA384_P384
- [ ] ECDSA_SHA512_P521
- [ ] RSA_SHA256_2048
- [ ] RSA_SHA384_3072
- [ ] RSA_SHA512_4096
- [ ] Ed25519
- [x] ElGamal
- [x] AES256
- Common Structures
- Common Type Specification
- [x] Integer
- [x] Date
- [x] String
- [x] PublicKey* As interface in lib/crypto
- [x] PrivateKey* As interface in lib/crypto
- [ ] SessionKey
- [ ] SigningPublicKey
- [ ] Signature
- [x] Hash
- [ ] Session Tag
- [ ] Tunnel ID
- [x] Certificate
- [ ] Mapping
- Common Structure Specification
- [ ] KeysAndCert
- [ ] RouterIdentity
- [ ] Destination
- [ ] Lease
- [ ] LeaseSet
- [ ] Lease2
- [ ] OfflineSigntature
- [ ] LeaseSet2Header
- [ ] LeaseSet2
- [ ] MetaLease
- [ ] MetaLeaseSet
- [ ] EncryptedLeaseSet
- [ ] RouterAddress
- [ ] RouterInfo
- [X] DSA
- [X] ECDSA_SHA256_P256
- [X] ECDSA_SHA384_P384
- [X] ECDSA_SHA512_P521
- [X] RSA_SHA256_2048
- [X] RSA_SHA384_3072
- [X] RSA_SHA512_4096
- [X] Ed25519
- [ ] Red25519
- [X] ElGamal
- [X] AES256
- [X] X25519
- [X] ChaCha20/Poly1305
- [ ] Elligator2
- [X] HKDF
- [X] HMAC
- [X] Noise subsystem
- End-to-End Crypto
- [ ] Garlic messages
- [ ] ElGamal/AES+SessionTag
- [ ] Ratchet/X25519
- I2NP
- [ ] Message parsing
- [ ] Message handling
- [X] Message parsing and serialization
- [X] Message interfaces and factory patterns
- [X] Database Store/Lookup message structures
- [X] Tunnel Build message structures
- [X] Data, DeliveryStatus, TunnelData messages
- [X] Build Request/Response Record parsing
- [ ] Message routing and handling
- NetDB
- [ ] Local storage
- [ ] Persistence to disk
- [ ] Reseeding
- [X] Local storage interface
- [X] Reseed functionality (basic implementation)
- [~] Persistence to disk
- [ ] RouterInfo management
- [ ] LeaseSet management
- [ ] Lookups
- [ ] Expiry
- [ ] Exploration
- [ ] Publishing
- [ ] Floodfill
- Transports
- [ ] Transport manager
- NTCP
- [ ] Handshake
- [ ] Session tracking
- [ ] Automatic session creation
- [ ] LS2 and Encrypted Leasesets
- Transport Layer
- [X] Transport manager and interfaces
- NTCP2
- [ ] Handshake
- [ ] Session tracking
- [ ] Automatic session creation
- [ ] SSU
- [X] Session handshake using noise protocol
- [X] Connection management
- [X] I2NP message framing and unframing
- [X] Session lifecycle management
- [X] Message queuing and worker threads
- SSU2
- [ ] Session handshake
- [ ] Connection management
- [ ] Peer Tests
- [ ] Introducers
- Tunnels
- [X] Message structure parsing (delivery instructions)
- [X] Fragment handling and reassembly
- [X] Build Request/Response record interfaces
- [ ] Tunnel building and management
- [ ] Tunnel cryptography (layered encryption)
- [ ] Gateway and endpoint implementation
- [ ] Participant functionality
- [Common Data Structures(see also: https://github.com/go-i2p/common](https://github.com/go-i2p/common)
- [X] Keys and Cert
- [X] Key Certificates
- [X] Certificate
- [X] Lease
- [X] Lease Set
- [X] Router Info
- [X] Router Identity
- [X] Router Address
- [X] Session Key
- [X] Signature Types
- [X] Destination
- [X] Data Types
- [X] Session Tag
## Verbosity ##
Logging can be enabled and configured using the `DEBUG_I2P` environment variable. By default, logging is disabled.
There are three available log levels:
- Debug
```shell
export DEBUG_I2P=debug
```
- Warn
```shell
export DEBUG_I2P=warn
```
- Error
```shell
export DEBUG_I2P=error
```
If DEBUG_I2P is set to an unrecognized variable, it will fall back to "debug".
## Fast-Fail mode ##
Fast-Fail mode can be activated by setting `WARNFAIL_I2P` to any non-empty value. When set, every warning or error is Fatal.
It is unsafe for production use, and intended only for debugging and testing purposes.
```shell
export WARNFAIL_I2P=true
```
If `WARNFAIL_I2P` is set and `DEBUG_I2P` is unset, `DEBUG_I2P` will be set to `debug`.
## Contributing

89
ROADMAP.md Normal file
View File

@@ -0,0 +1,89 @@
# go-i2p Implementation Roadmap
## Completed Components ✅
### Transport Layer (NTCP2)
-**Core NTCP2 Implementation**: Complete functional NTCP2 transport
* ✅ Session handshake using noise protocol
* ✅ Inbound and outbound connection management
* ✅ I2NP message framing and unframing
* ✅ Session lifecycle management with proper cleanup
* ✅ Message queuing with background workers
* ✅ RouterInfo compatibility checking
* ✅ Error handling and session recovery
### I2NP Message System
-**Core Message Infrastructure**: Complete I2NP message framework
* ✅ Message parsing and serialization (NTCP format)
* ✅ Interface-based message system with factory patterns
* ✅ Data, DeliveryStatus, TunnelData message implementations
* ✅ Database Store/Lookup message structures
* ✅ Tunnel Build/Reply message structures
* ✅ Build Request/Response Record parsing and interfaces
### Tunnel Message Processing
-**Message Structure Handling**: Tunnel message framework
* ✅ Delivery Instructions parsing and validation
* ✅ Fragment handling and reassembly logic
* ✅ Tunnel message structure parsing
* ✅ Build record interface implementations
### Common Data Structures
-**Complete Data Structure Support**: All I2P data types implemented
* ✅ Keys and Certificates, Router Info/Address
* ✅ Session Keys, Hashes, Signatures
* ✅ Lease and LeaseSet structures
## In Progress Components 🚧
### NetDb Implementation
- **Database Store Integration**:
* 📋 Database Store message handling implementation
* 📋 RouterInfo storage and retrieval
* 📋 LeaseSet management and storage
* 📋 Database lookup system
* 📋 Peer selection logic (basic implementation)
## Next Priority Components 🎯
### Tunnel Building System
- **Active Tunnel Management**:
* 📋 Tunnel building coordination
* 📋 Build request/response handling
* 📋 Gateway and endpoint implementations
* 📋 Participant tunnel processing
### Tunnel Cryptography
- **Security Layer Implementation**:
* 📋 Layered encryption/decryption
* 📋 Key generation and management
* 📋 Tunnel message forwarding logic
## Future Components 📅
### SSU2 Transport (Post-NTCP2)
- **Secondary Transport Protocol**:
* 📋 SSU2 handshake implementation
* 📋 UDP-based session management
* 📋 Peer testing mechanisms
* 📋 Introducer functionality
### Advanced NetDb Features
- **Enhanced Database Operations**:
* 📋 Floodfill router functionality
* 📋 Database exploration and publishing
* 📋 LS2 and Encrypted LeaseSet support
* 📋 Advanced peer selection algorithms
### Application Layer
- **Client Applications**:
* 📋 I2CP implementation
* 📋 Streaming library
* 📋 Datagram support
* 📋 End-to-end encryption (Garlic routing)
## Current Status
**Primary Goal**: NTCP2 transport is feature-complete and actively sending/receiving I2NP messages. The foundation for tunnel building and NetDb integration is in place. Next major milestone is implementing database operations and tunnel building.
**Test Coverage**: Core components have basic test coverage including NTCP2 sessions, I2NP message processing, and tunnel message parsing.

19
callgraph.sh Executable file
View File

@@ -0,0 +1,19 @@
#! /usr/bin/env sh
dirs=$(find lib/ -type d)
for dir in $dirs; do
files=$(find "$dir" -maxdepth 2 -type f -name "*.go" -not -name "fuzz")
#echo "Files in $dir: $files"
file=$(echo $files | awk '{print $1}')
if [ -z "$file" ]; then
echo "no go files, skipping"
continue
fi
packageLine=$(grep -E "^package" $file)
package=$(echo $packageLine | awk '{print $2}')
echo "Generating callgraph for $package"
go-callvis -nostd -focus "$package" -group type -format svg -file $dir/$package "github.com/go-i2p/go-i2p/$dir"
godocdown -template template.md -o "$dir/README.md" "./$dir"
git add -v "$dir/README.md"
git add -v "$dir/$package.svg" "$dir/README.md"
done

52
go.mod
View File

@@ -1,9 +1,53 @@
module github.com/go-i2p/go-i2p
go 1.16
go 1.24.2
require (
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20210415154028-4f45737414dc
github.com/beevik/ntp v1.4.3
github.com/eyedeekay/go-unzip v0.0.0-20240201194209-560d8225b50e
github.com/go-i2p/common v0.0.0-20250715213359-dfa5527ece83
github.com/go-i2p/crypto v0.0.0-20250716230511-565a0995440c
github.com/go-i2p/go-noise v0.0.0-20250805210353-74f980a2439d
github.com/go-i2p/logger v0.0.0-20241123010126-3050657e5d0c
github.com/go-i2p/su3 v0.0.0-20250716183548-497fadf45e84
github.com/go-i2p/util v0.0.0-20250806013618-d0b686a4f694
github.com/samber/oops v1.19.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.9.1
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.10.0
gopkg.in/yaml.v3 v3.0.1
)
require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dchest/siphash v1.2.3 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-i2p/noise v0.0.0-20250805205922-091c71f48c43 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/magiconair/properties v1.8.9 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/oklog/ulid/v2 v2.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/samber/lo v1.51.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.opentelemetry.io/otel v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
go.step.sm/crypto v0.67.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.40.0 // indirect
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sys v0.34.0 // indirect
golang.org/x/text v0.27.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)

121
go.sum
View File

@@ -1,24 +1,111 @@
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/beevik/ntp v1.4.3 h1:PlbTvE5NNy4QHmA4Mg57n7mcFTmr1W1j3gcK7L1lqho=
github.com/beevik/ntp v1.4.3/go.mod h1:Unr8Zg+2dRn7d8bHFuehIMSvvUYssHMxW3Q5Nx4RW5Q=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dchest/siphash v1.2.3 h1:QXwFc8cFOR2dSa/gE6o/HokBMWtLUaNDVd+22aKHeEA=
github.com/dchest/siphash v1.2.3/go.mod h1:0NvQU092bT0ipiFN++/rXm69QG9tVxLAlQHIXMPAkHc=
github.com/eyedeekay/go-unzip v0.0.0-20240201194209-560d8225b50e h1:NMjWYVkgcQHGOy0/VxU0TU6smrcoxzj9hwDesx2sB0w=
github.com/eyedeekay/go-unzip v0.0.0-20240201194209-560d8225b50e/go.mod h1:fKfFM3BsOOyjtZmEty7FsGzGabXo8Eb/dHjyIhTtxsE=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-i2p/common v0.0.0-20250715213359-dfa5527ece83 h1:F6xM06QyqR+qMYA4SzWzUzfVmkSE1P41tHK32TmGxP8=
github.com/go-i2p/common v0.0.0-20250715213359-dfa5527ece83/go.mod h1:e6X6esQk0zaevdZPZecKY7n8+wOfOLukQfWw558DYfk=
github.com/go-i2p/crypto v0.0.0-20250716230511-565a0995440c h1:s+bMNveuZg8rhIolwy7w451Y4qirhhYZbbmvLfBIDw4=
github.com/go-i2p/crypto v0.0.0-20250716230511-565a0995440c/go.mod h1:5felGikM6K5D95TLvVxew1UfR0BdtPpfmJLZa8cuY5U=
github.com/go-i2p/go-noise v0.0.0-20250805210353-74f980a2439d h1:4DKwGZZ2yalAjrrOTw9Zoz31lOMXysw5PZTqKYazlVw=
github.com/go-i2p/go-noise v0.0.0-20250805210353-74f980a2439d/go.mod h1:lNh+uKTp1nBVhY1MqJ7sNQWORRf1SMmYvu10Suv0zT8=
github.com/go-i2p/logger v0.0.0-20241123010126-3050657e5d0c h1:VTiECn3dFEmUlZjto+wOwJ7SSJTHPLyNprQMR5HzIMI=
github.com/go-i2p/logger v0.0.0-20241123010126-3050657e5d0c/go.mod h1:te7Zj3g3oMeIl8uBXAgO62UKmZ6m6kHRNg1Mm+X8Hzk=
github.com/go-i2p/noise v0.0.0-20250805205922-091c71f48c43 h1:wHDEEr99CEe+2xQ/cqCt8g8QYw1JBqc8Fb/sg2A+K6U=
github.com/go-i2p/noise v0.0.0-20250805205922-091c71f48c43/go.mod h1:yxzyP2upqal6mXWPWIPy7kuc1uuLzDrA21PSO5op9nE=
github.com/go-i2p/su3 v0.0.0-20250716183548-497fadf45e84 h1:aEDC9JJGnPsUCOzyCuiOoGN8ByZ64xVs7dOKOawfImg=
github.com/go-i2p/su3 v0.0.0-20250716183548-497fadf45e84/go.mod h1:khgAcQvD8LNY33zwha+ODxEdnHZRkDjQsdnnwojr7Ek=
github.com/go-i2p/util v0.0.0-20250806013618-d0b686a4f694 h1:uRw0dKhNKXJI9yP9XfpkkMlkE2Cz3NBeWFOvAhb4CKA=
github.com/go-i2p/util v0.0.0-20250806013618-d0b686a4f694/go.mod h1:y8THMwrKFrIW+GGwhZHJmm7jBO1dHwegh5L1HQVu49o=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM=
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/oklog/ulid/v2 v2.1.1 h1:suPZ4ARWLOJLegGFiZZ1dFAkqzhMjL3J1TzI+5wHz8s=
github.com/oklog/ulid/v2 v2.1.1/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ=
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/samber/lo v1.51.0 h1:kysRYLbHy/MB7kQZf5DSN50JHmMsNEdeY24VzJFu7wI=
github.com/samber/lo v1.51.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
github.com/samber/oops v1.19.0 h1:sfZAwC8MmTXBRRyNc4Z1utuTPBx+hFKF5fJ9DEQRZfw=
github.com/samber/oops v1.19.0/go.mod h1:+f+61dbiMxEMQ8gw/zTxW2pk+YGobaDM4glEHQtPOww=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20210415154028-4f45737414dc h1:+q90ECDSAQirdykUN6sPEiBXBsp8Csjcca8Oy7bgLTA=
golang.org/x/crypto v0.0.0-20210415154028-4f45737414dc/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
go.step.sm/crypto v0.67.0 h1:1km9LmxMKG/p+mKa1R4luPN04vlJYnRLlLQrWv7egGU=
go.step.sm/crypto v0.67.0/go.mod h1:+AoDpB0mZxbW/PmOXuwkPSpXRgaUaoIK+/Wx/HGgtAU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM=
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

57
lib/bootstrap/README.md Normal file
View File

@@ -0,0 +1,57 @@
# bootstrap
--
import "github.com/go-i2p/go-i2p/lib/bootstrap"
![bootstrap.svg](bootstrap.svg)
provides generic interfaces for initial bootstrap into network and network
### reseeding
## Usage
#### type Bootstrap
```go
type Bootstrap interface {
// get more peers for bootstrap
// try obtaining at most n router infos
// if n is 0 then try obtaining as many router infos as possible
// returns nil and error if we cannot fetch ANY router infos
// returns a channel that yields 1 slice of router infos containing n or fewer router infos, caller must close channel after use
GetPeers(ctx context.Context, n int) ([]router_info.RouterInfo, error)
}
```
interface defining a way to bootstrap into the i2p network
#### type ReseedBootstrap
```go
type ReseedBootstrap struct {
}
```
ReseedBootstrap implements the Bootstrap interface using HTTP reseeding
#### func NewReseedBootstrap
```go
func NewReseedBootstrap(config *config.BootstrapConfig) *ReseedBootstrap
```
NewReseedBootstrap creates a new reseeder with the provided configuration
#### func (*ReseedBootstrap) GetPeers
```go
func (rb *ReseedBootstrap) GetPeers(ctx context.Context, n int) ([]router_info.RouterInfo, error)
```
GetPeers implements the Bootstrap interface by obtaining RouterInfos from
configured reseed servers
bootstrap
github.com/go-i2p/go-i2p/lib/bootstrap
[go-i2p template file](/template.md)

View File

@@ -1,6 +1,10 @@
package bootstrap
import "github.com/go-i2p/go-i2p/lib/common"
import (
"context"
"github.com/go-i2p/common/router_info"
)
// interface defining a way to bootstrap into the i2p network
type Bootstrap interface {
@@ -9,5 +13,5 @@ type Bootstrap interface {
// if n is 0 then try obtaining as many router infos as possible
// returns nil and error if we cannot fetch ANY router infos
// returns a channel that yields 1 slice of router infos containing n or fewer router infos, caller must close channel after use
GetPeers(n int) (chan []common.RouterInfo, error)
GetPeers(ctx context.Context, n int) ([]router_info.RouterInfo, error)
}

258
lib/bootstrap/bootstrap.svg Normal file
View File

@@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: gocallvis Pages: 1 -->
<svg width="365pt" height="722pt"
viewBox="0.00 0.00 364.72 722.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(0 722)">
<title>gocallvis</title>
<polygon fill="#d3d3d3" stroke="transparent" points="0,0 0,-722 364.7182,-722 364.7182,0 0,0"/>
<g id="clust1" class="cluster">
<title>cluster_focus</title>
<polygon fill="#e6ecfa" stroke="#000000" stroke-width=".5" points="0,-8 0,-714 356.7182,-714 356.7182,-8 0,-8"/>
<text text-anchor="middle" x="178.3591" y="-693.8" font-family="Arial" font-size="18.00" fill="#000000">bootstrap</text>
</g>
<g id="clust5" class="cluster">
<title>cluster_github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.Reseed</title>
<g id="a_clust5"><a xlink:title="type: github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.Reseed">
<path fill="#eed8ae" stroke="#000000" stroke-width=".5" d="M242.0218,-598C242.0218,-598 334.2252,-598 334.2252,-598 340.2252,-598 346.2252,-604 346.2252,-610 346.2252,-610 346.2252,-664 346.2252,-664 346.2252,-670 340.2252,-676 334.2252,-676 334.2252,-676 242.0218,-676 242.0218,-676 236.0218,-676 230.0218,-670 230.0218,-664 230.0218,-664 230.0218,-610 230.0218,-610 230.0218,-604 236.0218,-598 242.0218,-598"/>
<text text-anchor="middle" x="288.1235" y="-606.5" font-family="Arial" font-size="15.00" fill="#222222">(Reseed)</text>
</a>
</g>
</g>
<g id="clust4" class="cluster">
<title>cluster_*github.com/sirupsen/logrus.Logger</title>
<g id="a_clust4"><a xlink:title="type: *github.com/sirupsen/logrus.Logger">
<path fill="#eed8ae" stroke="#000000" stroke-width=".5" d="M261.4629,-451C261.4629,-451 315.7841,-451 315.7841,-451 321.7841,-451 327.7841,-457 327.7841,-463 327.7841,-463 327.7841,-578 327.7841,-578 327.7841,-584 321.7841,-590 315.7841,-590 315.7841,-590 261.4629,-590 261.4629,-590 255.4629,-590 249.4629,-584 249.4629,-578 249.4629,-578 249.4629,-463 249.4629,-463 249.4629,-457 255.4629,-451 261.4629,-451"/>
<text text-anchor="middle" x="288.6235" y="-459.5" font-family="Arial" font-size="15.00" fill="#222222">(*Logger)</text>
</a>
</g>
</g>
<g id="clust3" class="cluster">
<title>cluster_*github.com/go&#45;i2p/logger.Logger</title>
<g id="a_clust3"><a xlink:title="type: *github.com/go&#45;i2p/logger.Logger">
<path fill="#eed8ae" stroke="#000000" stroke-width=".5" d="M249.0141,-182C249.0141,-182 327.2329,-182 327.2329,-182 333.2329,-182 339.2329,-188 339.2329,-194 339.2329,-194 339.2329,-431 339.2329,-431 339.2329,-437 333.2329,-443 327.2329,-443 327.2329,-443 249.0141,-443 249.0141,-443 243.0141,-443 237.0141,-437 237.0141,-431 237.0141,-431 237.0141,-194 237.0141,-194 237.0141,-188 243.0141,-182 249.0141,-182"/>
<text text-anchor="middle" x="288.1235" y="-190.5" font-family="Arial" font-size="15.00" fill="#222222">(*Logger)</text>
</a>
</g>
</g>
<g id="clust2" class="cluster">
<title>cluster_*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap</title>
<g id="a_clust2"><a xlink:title="type: *github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap">
<path fill="#b0c4de" stroke="#000000" stroke-width=".5" d="M20,-304C20,-304 143.5288,-304 143.5288,-304 149.5288,-304 155.5288,-310 155.5288,-316 155.5288,-316 155.5288,-370 155.5288,-370 155.5288,-376 149.5288,-382 143.5288,-382 143.5288,-382 20,-382 20,-382 14,-382 8,-376 8,-370 8,-370 8,-316 8,-316 8,-310 14,-304 20,-304"/>
<text text-anchor="middle" x="81.7644" y="-312.5" font-family="Arial" font-size="15.00" fill="#222222">(*ReseedBootstrap)</text>
</a>
</g>
</g>
<!-- github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.init -->
<g id="node1" class="node">
<title>github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.init</title>
<g id="a_node1"><a xlink:title="github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.init | defined in .:0&#10;at reseed_bootstrap.go:15: calling [github.com/go&#45;i2p/logger.GetGoI2PLogger]">
<path fill="#add8e6" stroke="#000000" stroke-width=".5" d="M96.2644,-52C96.2644,-52 66.2644,-52 66.2644,-52 60.2644,-52 54.2644,-46 54.2644,-40 54.2644,-40 54.2644,-28 54.2644,-28 54.2644,-22 60.2644,-16 66.2644,-16 66.2644,-16 96.2644,-16 96.2644,-16 102.2644,-16 108.2644,-22 108.2644,-28 108.2644,-28 108.2644,-40 108.2644,-40 108.2644,-46 102.2644,-52 96.2644,-52"/>
<text text-anchor="middle" x="81.2644" y="-29.8" font-family="Verdana" font-size="14.00" fill="#000000">init</text>
</a>
</g>
</g>
<!-- github.com/go&#45;i2p/logger.GetGoI2PLogger -->
<g id="node2" class="node">
<title>github.com/go&#45;i2p/logger.GetGoI2PLogger</title>
<g id="a_node2"><a xlink:title="github.com/go&#45;i2p/logger.GetGoI2PLogger | defined in log.go:120">
<path fill="#ffe4b5" stroke="#000000" stroke-width="1.5" d="M336.813,-52C336.813,-52 239.434,-52 239.434,-52 233.434,-52 227.434,-46 227.434,-40 227.434,-40 227.434,-28 227.434,-28 227.434,-22 233.434,-16 239.434,-16 239.434,-16 336.813,-16 336.813,-16 342.813,-16 348.813,-22 348.813,-28 348.813,-28 348.813,-40 348.813,-40 348.813,-46 342.813,-52 336.813,-52"/>
<text text-anchor="middle" x="288.1235" y="-38.2" font-family="Verdana" font-size="14.00" fill="#000000">logger</text>
<text text-anchor="middle" x="288.1235" y="-21.4" font-family="Verdana" font-size="14.00" fill="#000000">GetGoI2PLogger</text>
</a>
</g>
</g>
<!-- github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.init&#45;&gt;github.com/go&#45;i2p/logger.GetGoI2PLogger -->
<g id="edge1" class="edge">
<title>github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.init&#45;&gt;github.com/go&#45;i2p/logger.GetGoI2PLogger</title>
<g id="a_edge1"><a xlink:title="at reseed_bootstrap.go:15: calling [github.com/go&#45;i2p/logger.GetGoI2PLogger]">
<path fill="none" stroke="#8b4513" d="M108.3076,-34C135.736,-34 179.3573,-34 216.7663,-34"/>
<polygon fill="#8b4513" stroke="#8b4513" points="217.1342,-37.5001 227.1342,-34 217.1341,-30.5001 217.1342,-37.5001"/>
</a>
</g>
</g>
<!-- github.com/samber/oops.Errorf -->
<g id="node3" class="node">
<title>github.com/samber/oops.Errorf</title>
<g id="a_node3"><a xlink:title="github.com/samber/oops.Errorf | defined in oops.go:34">
<path fill="#ffe4b5" stroke="#000000" stroke-width="1.5" d="M305.3188,-113C305.3188,-113 270.9282,-113 270.9282,-113 264.9282,-113 258.9282,-107 258.9282,-101 258.9282,-101 258.9282,-89 258.9282,-89 258.9282,-83 264.9282,-77 270.9282,-77 270.9282,-77 305.3188,-77 305.3188,-77 311.3188,-77 317.3188,-83 317.3188,-89 317.3188,-89 317.3188,-101 317.3188,-101 317.3188,-107 311.3188,-113 305.3188,-113"/>
<text text-anchor="middle" x="288.1235" y="-99.2" font-family="Verdana" font-size="14.00" fill="#000000">oops</text>
<text text-anchor="middle" x="288.1235" y="-82.4" font-family="Verdana" font-size="14.00" fill="#000000">Errorf</text>
</a>
</g>
</g>
<!-- github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.NewReseed -->
<g id="node4" class="node">
<title>github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.NewReseed</title>
<g id="a_node4"><a xlink:title="github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.NewReseed | defined in new.go:10">
<path fill="#ffe4b5" stroke="#000000" stroke-width="1.5" d="M321.4764,-174C321.4764,-174 254.7706,-174 254.7706,-174 248.7706,-174 242.7706,-168 242.7706,-162 242.7706,-162 242.7706,-150 242.7706,-150 242.7706,-144 248.7706,-138 254.7706,-138 254.7706,-138 321.4764,-138 321.4764,-138 327.4764,-138 333.4764,-144 333.4764,-150 333.4764,-150 333.4764,-162 333.4764,-162 333.4764,-168 327.4764,-174 321.4764,-174"/>
<text text-anchor="middle" x="288.1235" y="-160.2" font-family="Verdana" font-size="14.00" fill="#000000">reseed</text>
<text text-anchor="middle" x="288.1235" y="-143.4" font-family="Verdana" font-size="14.00" fill="#000000">NewReseed</text>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers -->
<g id="node5" class="node">
<title>(*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers</title>
<g id="a_node5"><a xlink:title="(*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers | defined in reseed_bootstrap.go:32&#10;at reseed_bootstrap.go:40: calling [github.com/samber/oops.Errorf]&#10;at reseed_bootstrap.go:52: calling [github.com/samber/oops.Errorf]&#10;at reseed_bootstrap.go:72: calling [github.com/samber/oops.Errorf]&#10;at reseed_bootstrap.go:46: calling [github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.NewReseed]&#10;at reseed_bootstrap.go:49: calling [(github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.Reseed).SingleReseed]&#10;at reseed_bootstrap.go:51: calling [(*github.com/go&#45;i2p/logger.Logger).WithError]&#10;at reseed_bootstrap.go:58: calling [(*github.com/go&#45;i2p/logger.Logger).WithFields]&#10;at reseed_bootstrap.go:62: calling [(*github.com/sirupsen/logrus.Logger).Info]&#10;at reseed_bootstrap.go:43: calling [(*github.com/go&#45;i2p/logger.Logger).WithField]&#10;at reseed_bootstrap.go:51: calling [(*github.com/go&#45;i2p/logger.Logger).WithField]&#10;at reseed_bootstrap.go:43: calling [(*github.com/sirupsen/logrus.Logger).Debug]&#10;at reseed_bootstrap.go:51: calling [(*github.com/go&#45;i2p/logger.Logger).Warn]">
<path fill="#add8e6" stroke="#000000" stroke-width="1.5" d="M106.2947,-374C106.2947,-374 56.2341,-374 56.2341,-374 50.2341,-374 44.2341,-368 44.2341,-362 44.2341,-362 44.2341,-350 44.2341,-350 44.2341,-344 50.2341,-338 56.2341,-338 56.2341,-338 106.2947,-338 106.2947,-338 112.2947,-338 118.2947,-344 118.2947,-350 118.2947,-350 118.2947,-362 118.2947,-362 118.2947,-368 112.2947,-374 106.2947,-374"/>
<text text-anchor="middle" x="81.2644" y="-351.8" font-family="Verdana" font-size="14.00" fill="#000000">GetPeers</text>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;github.com/samber/oops.Errorf -->
<g id="edge2" class="edge">
<title>(*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;github.com/samber/oops.Errorf</title>
<g id="a_edge2"><a xlink:title="at reseed_bootstrap.go:40: calling [github.com/samber/oops.Errorf]&#10;at reseed_bootstrap.go:52: calling [github.com/samber/oops.Errorf]&#10;at reseed_bootstrap.go:72: calling [github.com/samber/oops.Errorf]">
<path fill="none" stroke="#8b4513" d="M118.4074,-352.073C131.5385,-349.0001 145.5161,-343.5697 155.5288,-334 190.8891,-300.2044 195.4391,-162.9154 227.5288,-126 233.5557,-119.0668 241.5102,-113.4857 249.6658,-109.0748"/>
<polygon fill="#8b4513" stroke="#8b4513" points="251.4166,-112.115 258.8672,-104.5824 248.3454,-105.8247 251.4166,-112.115"/>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.NewReseed -->
<g id="edge3" class="edge">
<title>(*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.NewReseed</title>
<g id="a_edge3"><a xlink:title="at reseed_bootstrap.go:46: calling [github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.NewReseed]">
<path fill="none" stroke="#8b4513" d="M118.6751,-351.3434C131.5313,-348.1844 145.2575,-342.8857 155.5288,-334 213.2793,-284.0401 171.3098,-229.6772 227.5288,-178 229.4394,-176.2438 231.5009,-174.6252 233.6705,-173.1338"/>
<polygon fill="#8b4513" stroke="#8b4513" points="235.6115,-176.0535 242.4829,-167.9892 232.0823,-170.0083 235.6115,-176.0535"/>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/logger.Logger).WithField -->
<g id="node6" class="node">
<title>(*github.com/go&#45;i2p/logger.Logger).WithField</title>
<g id="a_node6"><a xlink:title="(*github.com/go&#45;i2p/logger.Logger).WithField | defined in log.go:54">
<path fill="#ffe4b5" stroke="#000000" stroke-width="1.5" d="M316.398,-252C316.398,-252 259.849,-252 259.849,-252 253.849,-252 247.849,-246 247.849,-240 247.849,-240 247.849,-228 247.849,-228 247.849,-222 253.849,-216 259.849,-216 259.849,-216 316.398,-216 316.398,-216 322.398,-216 328.398,-222 328.398,-228 328.398,-228 328.398,-240 328.398,-240 328.398,-246 322.398,-252 316.398,-252"/>
<text text-anchor="middle" x="288.1235" y="-238.2" font-family="Verdana" font-size="14.00" fill="#000000">logger</text>
<text text-anchor="middle" x="288.1235" y="-221.4" font-family="Verdana" font-size="14.00" fill="#000000">WithField</text>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/go&#45;i2p/logger.Logger).WithField -->
<g id="edge8" class="edge">
<title>(*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/go&#45;i2p/logger.Logger).WithField</title>
<g id="a_edge8"><a xlink:title="at reseed_bootstrap.go:43: calling [(*github.com/go&#45;i2p/logger.Logger).WithField]&#10;at reseed_bootstrap.go:51: calling [(*github.com/go&#45;i2p/logger.Logger).WithField]">
<path fill="none" stroke="#8b4513" d="M118.5683,-348.6617C130.8549,-345.2944 144.2489,-340.5496 155.5288,-334 193.8581,-311.7444 191.4175,-290.6986 227.5288,-265 231.4159,-262.2337 235.5842,-259.5689 239.8482,-257.0424"/>
<polygon fill="#8b4513" stroke="#8b4513" points="241.6859,-260.0242 248.6757,-252.0623 238.2464,-253.9275 241.6859,-260.0242"/>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/logger.Logger).WithError -->
<g id="node7" class="node">
<title>(*github.com/go&#45;i2p/logger.Logger).WithError</title>
<g id="a_node7"><a xlink:title="(*github.com/go&#45;i2p/logger.Logger).WithError | defined in log.go:66">
<path fill="#ffe4b5" stroke="#000000" stroke-width="1.5" d="M316.655,-313C316.655,-313 259.592,-313 259.592,-313 253.592,-313 247.592,-307 247.592,-301 247.592,-301 247.592,-289 247.592,-289 247.592,-283 253.592,-277 259.592,-277 259.592,-277 316.655,-277 316.655,-277 322.655,-277 328.655,-283 328.655,-289 328.655,-289 328.655,-301 328.655,-301 328.655,-307 322.655,-313 316.655,-313"/>
<text text-anchor="middle" x="288.1235" y="-299.2" font-family="Verdana" font-size="14.00" fill="#000000">logger</text>
<text text-anchor="middle" x="288.1235" y="-282.4" font-family="Verdana" font-size="14.00" fill="#000000">WithError</text>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/go&#45;i2p/logger.Logger).WithError -->
<g id="edge5" class="edge">
<title>(*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/go&#45;i2p/logger.Logger).WithError</title>
<g id="a_edge5"><a xlink:title="at reseed_bootstrap.go:51: calling [(*github.com/go&#45;i2p/logger.Logger).WithError]">
<path fill="none" stroke="#8b4513" d="M118.725,-344.9534C151.9288,-335.162 200.7001,-320.78 237.3948,-309.9592"/>
<polygon fill="#8b4513" stroke="#8b4513" points="238.7997,-313.194 247.4014,-307.0084 236.8198,-306.4798 238.7997,-313.194"/>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/logger.Logger).Warn -->
<g id="node8" class="node">
<title>(*github.com/go&#45;i2p/logger.Logger).Warn</title>
<g id="a_node8"><a xlink:title="(*github.com/go&#45;i2p/logger.Logger).Warn | defined in log.go:30">
<path fill="#ffe4b5" stroke="#000000" stroke-width="1.5" d="M305.8898,-374C305.8898,-374 270.3572,-374 270.3572,-374 264.3572,-374 258.3572,-368 258.3572,-362 258.3572,-362 258.3572,-350 258.3572,-350 258.3572,-344 264.3572,-338 270.3572,-338 270.3572,-338 305.8898,-338 305.8898,-338 311.8898,-338 317.8898,-344 317.8898,-350 317.8898,-350 317.8898,-362 317.8898,-362 317.8898,-368 311.8898,-374 305.8898,-374"/>
<text text-anchor="middle" x="288.1235" y="-360.2" font-family="Verdana" font-size="14.00" fill="#000000">logger</text>
<text text-anchor="middle" x="288.1235" y="-343.4" font-family="Verdana" font-size="14.00" fill="#000000">Warn</text>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/go&#45;i2p/logger.Logger).Warn -->
<g id="edge10" class="edge">
<title>(*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/go&#45;i2p/logger.Logger).Warn</title>
<g id="a_edge10"><a xlink:title="at reseed_bootstrap.go:51: calling [(*github.com/go&#45;i2p/logger.Logger).Warn]">
<path fill="none" stroke="#8b4513" d="M118.725,-356C155.3343,-356 210.8683,-356 248.2746,-356"/>
<polygon fill="#8b4513" stroke="#8b4513" points="248.3136,-359.5001 258.3136,-356 248.3135,-352.5001 248.3136,-359.5001"/>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/logger.Logger).WithFields -->
<g id="node9" class="node">
<title>(*github.com/go&#45;i2p/logger.Logger).WithFields</title>
<g id="a_node9"><a xlink:title="(*github.com/go&#45;i2p/logger.Logger).WithFields | defined in log.go:60">
<path fill="#ffe4b5" stroke="#000000" stroke-width="1.5" d="M319.3426,-435C319.3426,-435 256.9044,-435 256.9044,-435 250.9044,-435 244.9044,-429 244.9044,-423 244.9044,-423 244.9044,-411 244.9044,-411 244.9044,-405 250.9044,-399 256.9044,-399 256.9044,-399 319.3426,-399 319.3426,-399 325.3426,-399 331.3426,-405 331.3426,-411 331.3426,-411 331.3426,-423 331.3426,-423 331.3426,-429 325.3426,-435 319.3426,-435"/>
<text text-anchor="middle" x="288.1235" y="-421.2" font-family="Verdana" font-size="14.00" fill="#000000">logger</text>
<text text-anchor="middle" x="288.1235" y="-404.4" font-family="Verdana" font-size="14.00" fill="#000000">WithFields</text>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/go&#45;i2p/logger.Logger).WithFields -->
<g id="edge6" class="edge">
<title>(*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/go&#45;i2p/logger.Logger).WithFields</title>
<g id="a_edge6"><a xlink:title="at reseed_bootstrap.go:58: calling [(*github.com/go&#45;i2p/logger.Logger).WithFields]">
<path fill="none" stroke="#8b4513" d="M118.725,-367.0466C151.1839,-376.6183 198.5195,-390.577 234.9071,-401.3072"/>
<polygon fill="#8b4513" stroke="#8b4513" points="234.2768,-404.7703 244.8585,-404.2417 236.2568,-398.0561 234.2768,-404.7703"/>
</a>
</g>
</g>
<!-- (*github.com/sirupsen/logrus.Logger).Debug -->
<g id="node10" class="node">
<title>(*github.com/sirupsen/logrus.Logger).Debug</title>
<g id="a_node10"><a xlink:title="(*github.com/sirupsen/logrus.Logger).Debug | defined in logger.go:221">
<path fill="#ffe4b5" stroke="#000000" stroke-width="1.5" d="M306.9455,-521C306.9455,-521 269.3015,-521 269.3015,-521 263.3015,-521 257.3015,-515 257.3015,-509 257.3015,-509 257.3015,-497 257.3015,-497 257.3015,-491 263.3015,-485 269.3015,-485 269.3015,-485 306.9455,-485 306.9455,-485 312.9455,-485 318.9455,-491 318.9455,-497 318.9455,-497 318.9455,-509 318.9455,-509 318.9455,-515 312.9455,-521 306.9455,-521"/>
<text text-anchor="middle" x="288.1235" y="-507.2" font-family="Verdana" font-size="14.00" fill="#000000">logrus</text>
<text text-anchor="middle" x="288.1235" y="-490.4" font-family="Verdana" font-size="14.00" fill="#000000">Debug</text>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/sirupsen/logrus.Logger).Debug -->
<g id="edge9" class="edge">
<title>(*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/sirupsen/logrus.Logger).Debug</title>
<g id="a_edge9"><a xlink:title="at reseed_bootstrap.go:43: calling [(*github.com/sirupsen/logrus.Logger).Debug]">
<path fill="none" stroke="#8b4513" d="M106.6294,-374.0251C143.6948,-400.3648 212.738,-449.4289 254.1541,-478.8604"/>
<polygon fill="#8b4513" stroke="#8b4513" points="252.3722,-481.8878 262.551,-484.8275 256.427,-476.1818 252.3722,-481.8878"/>
</a>
</g>
</g>
<!-- (*github.com/sirupsen/logrus.Logger).Info -->
<g id="node11" class="node">
<title>(*github.com/sirupsen/logrus.Logger).Info</title>
<g id="a_node11"><a xlink:title="(*github.com/sirupsen/logrus.Logger).Info | defined in logger.go:225">
<path fill="#ffe4b5" stroke="#000000" stroke-width="1.5" d="M305.6193,-582C305.6193,-582 270.6277,-582 270.6277,-582 264.6277,-582 258.6277,-576 258.6277,-570 258.6277,-570 258.6277,-558 258.6277,-558 258.6277,-552 264.6277,-546 270.6277,-546 270.6277,-546 305.6193,-546 305.6193,-546 311.6193,-546 317.6193,-552 317.6193,-558 317.6193,-558 317.6193,-570 317.6193,-570 317.6193,-576 311.6193,-582 305.6193,-582"/>
<text text-anchor="middle" x="288.1235" y="-568.2" font-family="Verdana" font-size="14.00" fill="#000000">logrus</text>
<text text-anchor="middle" x="288.1235" y="-551.4" font-family="Verdana" font-size="14.00" fill="#000000">Info</text>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/sirupsen/logrus.Logger).Info -->
<g id="edge7" class="edge">
<title>(*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(*github.com/sirupsen/logrus.Logger).Info</title>
<g id="a_edge7"><a xlink:title="at reseed_bootstrap.go:62: calling [(*github.com/sirupsen/logrus.Logger).Info]">
<path fill="none" stroke="#8b4513" d="M92.3256,-374.0399C114.3749,-408.7975 166.9292,-485.8578 227.5288,-534 234.1285,-539.243 241.7932,-543.9051 249.4061,-547.8995"/>
<polygon fill="#8b4513" stroke="#8b4513" points="248.0753,-551.1458 258.5915,-552.435 251.1745,-544.8692 248.0753,-551.1458"/>
</a>
</g>
</g>
<!-- (github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.Reseed).SingleReseed -->
<g id="node12" class="node">
<title>(github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.Reseed).SingleReseed</title>
<g id="a_node12"><a xlink:title="(github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.Reseed).SingleReseed | defined in reseed.go:31">
<path fill="#ffe4b5" stroke="#000000" stroke-width="1.5" d="M326.3271,-668C326.3271,-668 249.9199,-668 249.9199,-668 243.9199,-668 237.9199,-662 237.9199,-656 237.9199,-656 237.9199,-644 237.9199,-644 237.9199,-638 243.9199,-632 249.9199,-632 249.9199,-632 326.3271,-632 326.3271,-632 332.3271,-632 338.3271,-638 338.3271,-644 338.3271,-644 338.3271,-656 338.3271,-656 338.3271,-662 332.3271,-668 326.3271,-668"/>
<text text-anchor="middle" x="288.1235" y="-654.2" font-family="Verdana" font-size="14.00" fill="#000000">reseed</text>
<text text-anchor="middle" x="288.1235" y="-637.4" font-family="Verdana" font-size="14.00" fill="#000000">SingleReseed</text>
</a>
</g>
</g>
<!-- (*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.Reseed).SingleReseed -->
<g id="edge4" class="edge">
<title>(*github.com/go&#45;i2p/go&#45;i2p/lib/bootstrap.ReseedBootstrap).GetPeers&#45;&gt;(github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.Reseed).SingleReseed</title>
<g id="a_edge4"><a xlink:title="at reseed_bootstrap.go:49: calling [(github.com/go&#45;i2p/go&#45;i2p/lib/netdb/reseed.Reseed).SingleReseed]">
<path fill="none" stroke="#8b4513" d="M89.919,-374.0435C110.3702,-415.6822 164.7136,-520.678 227.5288,-596 236.2167,-606.4176 246.9389,-616.6363 256.9371,-625.3325"/>
<polygon fill="#8b4513" stroke="#8b4513" points="254.8567,-628.1572 264.7475,-631.9549 259.3837,-622.8181 254.8567,-628.1572"/>
</a>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1,4 +1,2 @@
//
// provides generic interfaces for initial bootstrap into network and network reseeding
//
package bootstrap

View File

@@ -0,0 +1,76 @@
package bootstrap
import (
"context"
"github.com/go-i2p/common/router_info"
"github.com/go-i2p/go-i2p/lib/config"
"github.com/go-i2p/go-i2p/lib/netdb/reseed"
"github.com/go-i2p/logger"
"github.com/sirupsen/logrus"
"github.com/samber/oops"
)
var log = logger.GetGoI2PLogger()
// ReseedBootstrap implements the Bootstrap interface using HTTP reseeding
type ReseedBootstrap struct {
// Configuration containing reseed servers
config *config.BootstrapConfig
}
// NewReseedBootstrap creates a new reseeder with the provided configuration
func NewReseedBootstrap(config *config.BootstrapConfig) *ReseedBootstrap {
return &ReseedBootstrap{
config: config,
}
}
// GetPeers implements the Bootstrap interface by obtaining RouterInfos
// from configured reseed servers
func (rb *ReseedBootstrap) GetPeers(ctx context.Context, n int) ([]router_info.RouterInfo, error) {
var allRouterInfos []router_info.RouterInfo
var lastErr error
// Try each reseed server until we get enough routerInfos or exhaust all servers
for _, server := range rb.config.ReseedServers {
// Check if context is canceled before making request
if ctx.Err() != nil {
return nil, oops.Errorf("reseed canceled: %v", ctx.Err())
}
log.WithField("server", server.Url).Debug("Attempting to reseed from server")
// Use the existing Reseed implementation with a timeout context
reseeder := reseed.NewReseed()
// Perform the actual reseeding operation synchronously
serverRIs, err := reseeder.SingleReseed(server.Url)
if err != nil {
log.WithError(err).WithField("server", server.Url).Warn("Reseed attempt failed")
lastErr = oops.Errorf("reseed from %s failed: %v", server.Url, err)
continue
}
// Add the retrieved RouterInfos to our collection
allRouterInfos = append(allRouterInfos, serverRIs...)
log.WithFields(logrus.Fields{
"server": server.Url,
"count": len(serverRIs),
"total": len(allRouterInfos),
}).Info("Successfully obtained router infos from reseed server")
// Check if we have enough RouterInfos
if n > 0 && len(allRouterInfos) >= n {
break
}
}
// If we couldn't get any RouterInfos from any server, return the last error
if len(allRouterInfos) == 0 && lastErr != nil {
return nil, oops.Errorf("all reseed attempts failed: %w", lastErr)
}
return allRouterInfos, nil
}

View File

@@ -1,18 +0,0 @@
//
// base32 encoding using I2P's alphabet
//
package base32
import (
b32 "encoding/base32"
)
var I2PEncoding *b32.Encoding = b32.NewEncoding("abcdefghijklmnopqrstuvwxyz234567")
//
// Return a go string of the I2P base32
// encoding of the provided byte slice
//
func EncodeToString(data []byte) string {
return I2PEncoding.EncodeToString(data)
}

View File

@@ -1,30 +0,0 @@
//
// base64 encoding using I2P's alphabet
//
package base64
import (
b64 "encoding/base64"
)
// i2p base64 alphabet
const Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~"
// i2p base64 encoding
var I2PEncoding *b64.Encoding = b64.NewEncoding(Alphabet)
//
// Return a go string of the I2P base64
// encoding of the provided byte slice
//
func EncodeToString(data []byte) string {
return I2PEncoding.EncodeToString(data)
}
//
// decode string using i2p base64 encoding
// returns error if data is malfromed
//
func DecodeFromString(str string) (d []byte, err error) {
return I2PEncoding.DecodeString(str)
}

View File

@@ -1,220 +0,0 @@
package common
/*
I2P Certificate
https://geti2p.net/spec/common-structures#certificate
Accurate for version 0.9.24
+----+----+----+----+----+-//
|type| length | payload
+----+----+----+----+----+-//
type :: Integer
length -> 1 byte
case 0 -> NULL
case 1 -> HASHCASH
case 2 -> HIDDEN
case 3 -> SIGNED
case 4 -> MULTIPLE
case 5 -> KEY
length :: Integer
length -> 2 bytes
payload :: data
length -> $length bytes
*/
import (
"errors"
log "github.com/sirupsen/logrus"
)
// Certificate Types
const (
CERT_NULL = iota
CERT_HASHCASH
CERT_HIDDEN
CERT_SIGNED
CERT_MULTIPLE
CERT_KEY
)
// Minimum size of a valid Certificate
const (
CERT_MIN_SIZE = 3
)
type CertificateInterface interface {
Cert() []byte
Length() (length int, err error)
Data() (data []byte, err error)
Type() (cert_type int, type_bytes []byte, err error)
SignatureSize() (size int)
}
type Certificate struct {
CertType *Integer
CertLen *Integer
CertBytes []byte
}
var ci CertificateInterface = &Certificate{}
func (certificate Certificate) SignatureSize() (size int) {
return 40
}
func (certificate Certificate) Cert() []byte {
var ret []byte
ret = append(ret, certificate.CertType.Bytes()...)
l, _ := certificate.Length()
//if err != nil && err.Error() != "certificate parsing warning: certificate data is shorter than specified by length" {
//}
data, _ := certificate.Data()
if l != 0 && len(data) != 0 {
ret = append(ret, certificate.CertLen.Bytes()...)
ret = append(ret, data...)
} else {
ret = append(ret, certificate.CertLen.Bytes()...)
}
//log.Println("\n\n CERTIFICATE: ", ret, l+CERT_MIN_SIZE, err)
return ret //[:l+CERT_MIN_SIZE]
}
//
// Return the Certificate Type specified in the first byte of the Certificate,
// and an error if the certificate is shorter than the minimum certificate size.
//
func (certificate Certificate) Type() (cert_type int, type_bytes []byte, err error) {
return certificate.CertType.Value(), certificate.CertType.Bytes(), nil
}
//
// Look up the length of the Certificate, reporting errors if the certificate is
// shorter than the minimum certificate size or if the reported length doesn't
// match the provided data.
//
func (certificate Certificate) Length() (length int, err error) {
if certificate.CertLen.Value() < 1 {
log.WithFields(log.Fields{
"at": "(Certificate) Length",
"certificate_bytes_length": certificate.CertLen,
"certificate_min_size": CERT_MIN_SIZE - 1,
"reason": "certificate is too short",
}).Warn("certificate format warning")
err = errors.New("error parsing certificate length: certificate is too short")
}
if certificate.CertLen.Value() > len(certificate.CertBytes) {
log.WithFields(log.Fields{
"at": "(Certificate) Length",
"certificate_bytes_length": certificate.CertLen,
"certificate_actual_length": len(certificate.CertBytes),
"reason": "certificate data is shorter than specified by length",
}).Warn("certificate format warning")
err = errors.New("certificate parsing warning: certificate data is shorter than specified by length")
length = certificate.CertLen.Value()
}
if certificate.CertLen.Value() < len(certificate.CertBytes) {
log.WithFields(log.Fields{
"at": "(Certificate) Length",
"certificate_bytes_length": certificate.CertLen,
"certificate_actual_length": len(certificate.CertBytes),
"reason": "certificate contains data beyond length",
}).Warn("certificate format warning")
err = errors.New("certificate parsing warning: certificate data is longer than specified by length")
length = certificate.CertLen.Value()
}
if err != nil {
return
}
length = certificate.CertLen.Value()
return
}
//
// Return the Certificate data and any errors encountered parsing the Certificate.
//
func (certificate Certificate) Data() (data []byte, err error) {
_, err = certificate.Length()
data = certificate.CertBytes
if err != nil {
switch err.Error() {
case "error parsing certificate length: certificate is too short":
return
case "certificate parsing warning: certificate data is shorter than specified by length":
data = certificate.CertBytes
return
case "certificate parsing warning: certificate data is longer than specified by length":
data = certificate.CertBytes[:certificate.CertLen.Value()]
return
}
}
return
}
//
// Read a Certificate from a slice of bytes, returning any extra data on the end of the slice
// and any errors if a valid Certificate could not be read.
//
func ReadCertificate(data []byte) (certificate *Certificate, remainder []byte, err error) {
certificate = &Certificate{}
certificate.CertType, err = NewInteger(data[0:1])
if err != nil {
log.WithFields(log.Fields{
"at": "(Certificate) ReadCertificate",
"certificate": certificate,
"data": data,
"reason": "error parsing certificate type",
"error": err,
"error_reason": err.Error(),
}).Warn("certificate format warning")
}
certificate.CertLen = &Integer{}
cert_len := len(data)
if cert_len < CERT_MIN_SIZE {
log.WithFields(log.Fields{
"at": "(Certificate) ReadCertificate",
"certificate_bytes_length": cert_len,
"certificate_min_size": CERT_MIN_SIZE,
"reason": "certificate is too short",
}).Warn("certificate format warning")
err = errors.New("error parsing certificate length: certificate is too short")
return
} else {
certificate.CertLen, err = NewInteger(data[1:CERT_MIN_SIZE])
// _, err = certificate.Type()
//log.Println("Calculated len AT LEN", cert_len, "Stated len AT LEN", certificate.CertLen.Value())
if err != nil {
//return
log.WithFields(log.Fields{
"at": "(Certificate) ReadCertificate",
"certificate_bytes_length": cert_len,
"certificate_min_size": CERT_MIN_SIZE,
"reason": "certificate size is invalid",
}).Warn("certificate format warning")
//err = errors.New("error parsing certificate type: certificate type is invalid")
}
certificate.CertBytes = data[CERT_MIN_SIZE:]
_, err = certificate.Length()
if err != nil {
switch err.Error() {
case "error parsing certificate length: certificate is too short":
certificate.CertLen, err = NewInteger([]byte{00000000})
return
case "certificate parsing warning: certificate data is shorter than specified by length":
return
case "certificate parsing warning: certificate data is longer than specified by length":
certificate.CertBytes = data[CERT_MIN_SIZE:]
l, _ := certificate.Length()
remainder = data[CERT_MIN_SIZE+l:]
return
}
}
}
return
}

View File

@@ -1,175 +0,0 @@
package common
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCertificateTypeIsFirstByte(t *testing.T) {
assert := assert.New(t)
bytes := []byte{0x03, 0x00, 0x00}
certificate, _, err := ReadCertificate(bytes)
if err != nil {
t.Log(err)
}
cert_type, _, err := certificate.Type()
assert.Equal(cert_type, 3, "certificate.Type() should be the first bytes in a certificate")
assert.Nil(err)
}
func TestCertificateLengthCorrect(t *testing.T) {
assert := assert.New(t)
bytes := []byte{0x03, 0x00, 0x02, 0xff, 0xff}
certificate, _, err := ReadCertificate(bytes)
assert.Nil(err, "ReadCertificate() should not return an error with valid data")
cert_len, err := certificate.Length()
assert.Nil(err, "ReadCertificate() should not return an error with valid data")
assert.Equal(cert_len, 2, "certificate.Length() should return integer from second two bytes")
assert.Nil(err, "ReadCertificate() should not return an error with valid data")
}
func TestCertificateLengthErrWhenTooShort(t *testing.T) {
assert := assert.New(t)
bytes := []byte{0x03, 0x01}
certificate, _, err := ReadCertificate(bytes)
if assert.NotNil(err) {
assert.Equal("error parsing certificate length: certificate is too short", err.Error(), "correct error message should be returned")
}
cert_len, err := certificate.Length()
assert.Equal(cert_len, 0, "certificate.Length() did not return zero length for missing length data")
if assert.NotNil(err) {
assert.Equal("error parsing certificate length: certificate is too short", err.Error(), "correct error message should be returned")
}
}
func TestCertificateLengthErrWhenDataTooShort(t *testing.T) {
assert := assert.New(t)
bytes := []byte{0x03, 0x00, 0x02, 0xff}
certificate, _, err := ReadCertificate(bytes)
if assert.NotNil(err) {
assert.Equal("certificate parsing warning: certificate data is shorter than specified by length", err.Error(), "correct error message should be returned")
}
cert_len, err := certificate.Length()
if assert.NotNil(err) {
assert.Equal("certificate parsing warning: certificate data is shorter than specified by length", err.Error(), "correct error message should be returned")
}
assert.Equal(cert_len, 2, "certificate.Length() did not return indicated length when data was actually missing")
if assert.NotNil(err) {
assert.Equal("certificate parsing warning: certificate data is shorter than specified by length", err.Error(), "correct error message should be returned")
}
}
func TestCertificateDataWhenCorrectSize(t *testing.T) {
assert := assert.New(t)
bytes := []byte{0x03, 0x00, 0x01, 0xaa}
certificate, _, err := ReadCertificate(bytes)
assert.Nil(err, "certificate.Data() returned error with valid data")
cert_len, err := certificate.Length()
assert.Nil(err, "certificate.Data() returned error with valid data")
assert.Equal(cert_len, 1, "certificate.Length() did not return indicated length when data was valid")
data, _ := NewInteger(certificate.CertBytes)
assert.Equal(170, data.Value(), "certificate.Data() returned incorrect data")
}
func TestCertificateDataWhenTooLong(t *testing.T) {
assert := assert.New(t)
bytes := []byte{0x03, 0x00, 0x02, 0xff, 0xff, 0xaa, 0xaa}
certificate, _, err := ReadCertificate(bytes)
if assert.NotNil(err) {
assert.Equal("certificate parsing warning: certificate data is longer than specified by length", err.Error(), "correct error message should be returned")
}
cert_len, err := certificate.Length()
if assert.NotNil(err) {
assert.Equal("certificate parsing warning: certificate data is longer than specified by length", err.Error(), "correct error message should be returned")
}
assert.Equal(cert_len, 2, "certificate.Length() did not return indicated length when data was too long")
if certificate.CertBytes[0] != 0xff || certificate.CertBytes[1] != 0xff {
t.Fatal("certificate.Data() returned incorrect data when data was too long")
}
}
func TestCertificateDataWhenTooShort(t *testing.T) {
assert := assert.New(t)
bytes := []byte{0x03, 0x00, 0x02, 0xff}
certificate, _, err := ReadCertificate(bytes)
if assert.NotNil(err) {
assert.Equal("certificate parsing warning: certificate data is shorter than specified by length", err.Error(), "correct error message should be returned")
}
cert_data, err := certificate.Data()
if assert.NotNil(err) {
assert.Equal("certificate parsing warning: certificate data is shorter than specified by length", err.Error(), "correct error message should be returned")
}
cert_len := len(cert_data)
assert.Equal(cert_len, 1, "certificate.Data() did not return correct amount of data when data too short")
assert.Equal(255, int(cert_data[0]), "certificate.Data() did not return correct data values when data was too short")
}
func TestReadCertificateWithCorrectData(t *testing.T) {
assert := assert.New(t)
bytes := []byte{0x00, 0x00, 0x02, 0xff, 0xff}
cert, remainder, err := ReadCertificate(bytes)
t.Log("CERT IS:", cert.Cert())
assert.Equal(len(cert.Cert()), 5, "ReadCertificate() did not return correct amount of data for valid certificate")
assert.Equal(len(remainder), 0, "ReadCertificate() did not return a zero length remainder on a valid certificate")
assert.Nil(err, "ReadCertificate() should not return an error with valid data")
}
func TestReadCertificateWithDataTooShort(t *testing.T) {
assert := assert.New(t)
bytes := []byte{0x00, 0x00, 0x02, 0xff}
cert, remainder, err := ReadCertificate(bytes)
assert.Equal(len(cert.Cert()), 4, "ReadCertificate() did not return correct amount of data for certificate with missing data")
assert.Equal(len(remainder), 0, "ReadCertificate() did not return a zero length remainder on certificate with missing data")
if assert.NotNil(err) {
assert.Equal("certificate parsing warning: certificate data is shorter than specified by length", err.Error(), "correct error message should be returned")
}
}
func TestReadCertificateWithRemainder(t *testing.T) {
assert := assert.New(t)
bytes := []byte{0x00, 0x00, 0x02, 0xff, 0xff, 0x01}
cert, remainder, err := ReadCertificate(bytes)
assert.Equal(len(cert.Cert()), 5, "ReadCertificate() did not return correct amount of data for certificate with extra data")
assert.Equal(len(remainder), 1, "ReadCertificate() returned incorrect length remainder on certificate with extra data")
assert.Equal(1, int(remainder[0]), "ReadCertificate() did not return correct remainder value")
assert.NotNil(err)
}
func TestReadCertificateWithInvalidLength(t *testing.T) {
assert := assert.New(t)
bytes := []byte{0x00, 0x00}
cert, remainder, err := ReadCertificate(bytes)
assert.Equal(len(cert.Cert()), 2, "ReadCertificate() should populate the certificate with the provided data even when invalid")
assert.Equal(len(remainder), 0, "ReadCertificate() returned non-zero length remainder on invalid certificate")
if assert.NotNil(err) {
assert.Equal("error parsing certificate length: certificate is too short", err.Error(), "correct error message should be returned")
}
}

View File

@@ -1,45 +0,0 @@
package common
/*
I2P Date
https://geti2p.net/spec/common-structures#date
Accurate for version 0.9.24
*/
import (
"errors"
log "github.com/sirupsen/logrus"
"time"
)
type Date [8]byte
const DATE_SIZE = 8
//
// Time takes the value stored in date as an 8 byte big-endian integer representing the
// number of milliseconds since the beginning of unix time and converts it to a Go time.Time
// struct.
//
func (date Date) Time() (date_time time.Time) {
seconds, _ := NewInteger(date[:])
date_time = time.Unix(0, int64(seconds.Value()*1000000))
return
}
func ReadDate(data []byte) (h Date, remainder []byte, err error) {
if len(data) < DATE_SIZE {
log.WithFields(log.Fields{
"at": "(Date) ReadDate",
"data_len": len(data),
"required_len": "8",
"reason": "date missing data",
}).Error("date error")
err = errors.New("error reading date, insufficient length")
copy(h[:], data[0:len(data)-1])
} else {
copy(h[:], data[0:DATE_SIZE-1])
copy(remainder, data[DATE_SIZE-1:])
}
return
}

View File

@@ -1,15 +0,0 @@
package common
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestTimeFromMiliseconds(t *testing.T) {
assert := assert.New(t)
next_day := Date{0x00, 0x00, 0x00, 0x00, 0x05, 0x26, 0x5c, 0x00}
go_time := next_day.Time()
assert.Equal(int64(86400), go_time.Unix(), "Date.Time() did not parse time in milliseconds")
}

View File

@@ -1,62 +0,0 @@
package common
/*
I2P Destination
https://geti2p.net/spec/common-structures#destination
Accurate for version 0.9.24
Identical to KeysAndCert
*/
import (
"github.com/go-i2p/go-i2p/lib/common/base32"
"github.com/go-i2p/go-i2p/lib/common/base64"
"github.com/go-i2p/go-i2p/lib/crypto"
"strings"
)
//
// A Destination is a KeysAndCert with functionallity
// for generating base32 and base64 addresses.
//
type Destination struct {
KeysAndCert
}
func (destination Destination) PublicKey() (crypto.PublicKey, error) {
return destination.KeysAndCert.GetPublicKey()
}
func (destination Destination) SigningPublicKey() (crypto.SigningPublicKey, error) {
return destination.KeysAndCert.GetSigningPublicKey()
}
func (destination Destination) Certificate() (CertificateInterface, error) {
return destination.KeysAndCert.GetCertificate()
}
//
// Generate the I2P base32 address for this Destination.
//
func (destination Destination) Base32Address() (str string) {
hash := crypto.SHA256(destination.Cert())
str = strings.Trim(base32.EncodeToString(hash[:]), "=")
str = str + ".b32.i2p"
return
}
//
// Generate the I2P base64 address for this Destination.
//
func (destination Destination) Base64() string {
return base64.EncodeToString(destination.Cert())
}
func ReadDestination(data []byte) (destination Destination, remainder []byte, err error) {
keys_and_cert, remainder, err := ReadKeysAndCert(data)
if err != nil {
return
}
destination.KeysAndCert = keys_and_cert
return
}

View File

@@ -1,14 +0,0 @@
FROM golang
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install libsodium-dev -y
RUN go get github.com/dvyukov/go-fuzz/go-fuzz
RUN go get github.com/dvyukov/go-fuzz/go-fuzz-build
RUN go get github.com/hkparker/go-i2p
RUN go get github.com/ddollar/forego
WORKDIR /go/src/github.com/hkparker/go-i2p
ENTRYPOINT ["make", "fuzz"]

View File

@@ -1,8 +0,0 @@
fuzz:
go-fuzz-build -o keys_and_cert/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/keys_and_cert
go-fuzz-build -o certificate/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/certificate
go-fuzz-build -o destination/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/destination
go-fuzz-build -o router_address/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/router_address
go-fuzz-build -o router_identity/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/router_identity
go-fuzz-build -o string/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/string
forego start

View File

@@ -1,6 +0,0 @@
keys_and_cert: go-fuzz -bin=keys_and_cert/exportable-fuzz.zip -workdir=lib/common/fuzz/keys_and_cert -procs=2
certificate: go-fuzz -bin=certificate/exportable-fuzz.zip -workdir=lib/common/fuzz/certificate -procs=2
destination: go-fuzz -bin=destination/exportable-fuzz.zip -workdir=lib/common/fuzz/destination -procs=2
router_address: go-fuzz -bin=router_address/exportable-fuzz.zip -workdir=lib/common/fuzz/router_address -procs=2
router_identity: go-fuzz -bin=router_identity/exportable-fuzz.zip -workdir=lib/common/fuzz/router_identity -procs=2
string: go-fuzz -bin=string/exportable-fuzz.zip -workdir=lib/common/fuzz/string -procs=2

View File

@@ -1 +0,0 @@


View File

@@ -1,11 +0,0 @@
package exportable
import "github.com/go-i2p/go-i2p/lib/common"
func Fuzz(data []byte) int {
cert := common.Certificate(data)
cert.Data()
cert.Length()
cert.Type()
return 0
}

View File

@@ -1,10 +0,0 @@
package exportable
import "github.com/go-i2p/go-i2p/lib/common"
func Fuzz(data []byte) int {
destination := common.Destination(data)
destination.Base32Address()
destination.Base64()
return 0
}

View File

@@ -1,11 +0,0 @@
package exportable
import "github.com/go-i2p/go-i2p/lib/common"
func Fuzz(data []byte) int {
keys_and_cert, _, _ := common.ReadKeysAndCert(data)
keys_and_cert.Certificate()
keys_and_cert.PublicKey()
keys_and_cert.SigningPublicKey()
return 0
}

Some files were not shown because too many files have changed in this diff Show More