Commit Graph

210 Commits

Author SHA1 Message Date
Adam Rocska 4064df3762 Finished hacking. I hope I'll have time for this library in the close future. I want to make it great.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-11 11:09:57 +02:00
Adam Rocska 7b487ccc60 In its current state this hackery fits our needs.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-11 10:22:15 +02:00
Adam Rocska c9bee263df Massaaged out this netmasking thingy. I had to reverse engineer with running other libraries, but now it seems to work. I'll follow the route of reversing using the java, C#.net, and php libraries. PHP is the driver, because the whole maxmind "solution" smells php from a mile away...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-10 22:44:18 +02:00
Adam Rocska 7ca52178dd Library starts to come into its place. I gotta go through the models & records once again, because de-phpification is pretty hard. Besides that it's all cool and usable so far.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-10 12:37:38 +02:00
Adam Rocska c4a0ce5960 Added the IpAddress netmask exposure. CIDR string my ass. This is no php.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-10 12:08:31 +02:00
Adam Rocska 7b85c3b56c Implemented bitwise operators for IpAddress. This will be handy if someone wants to go wild with Ip subnetting, masking, grouping, etc.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-09 23:01:21 +02:00
Adam Rocska 2f43056d0a IpAddress now has netmask initializers. There's no point in implementing a awhole ip range, or network or any other type, as technically at the end of the day, the maxmind php scripters only return a network mask as a new information in their CIDR voodoo.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-09 22:35:02 +02:00
Adam Rocska 6abcb9669a Made the IpAddress comparable, which is the front door to the type IpRange.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-07 21:33:46 +02:00
Adam Rocska d646b47877 System tests ready for execution. Before coverage I'll take another round in the php rat hole to make sure all models are ok.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-05 16:09:44 +02:00
Adam Rocska d662ad3d22 Until CLIon supports newer Swift, and Swift Package Manager versions, and SPM fixes https://bugs.swift.org/browse/SR-12912 I opt in to doing this hackery for test resources.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-05 13:45:28 +02:00
Adam Rocska 2cd55ef5ab Reorganized Tests
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-04 17:31:24 +02:00
Adam Rocska 52b4c5cb7c Some hackery to get the models & records into some shape, in hope, that another pattern emerges.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-04 17:28:07 +02:00
Adam Rocska f5b45e7e69 Reader coverage.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-04 14:35:45 +02:00
Adam Rocska 62484d2cae Work in progress. A pretty neat pattern is emerging.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-04 13:47:18 +02:00
Adam Rocska e1a5976007 Committing the complete mess. I managed to trial&error on converting the php fantasy dictionaries into structs. Though some of the field types are mere blind guesses, so fingers crossed.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-02 16:38:44 +02:00
Adam Rocska 1bf6817aab Data can be read nicely. Next stop : Finish the API layer. Once done :
- clean up the tests
 - refactor parts of the source
 - find additional optimization opportunities. I don't like the slow init.
 - document
 - tell the world it's done

Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-01 14:29:02 +02:00
Adam Rocska aa6d2958c7 I couldn't let this whole repo go. Eventually I solved the slow index buildup with a lazy normalizataion & solved the one last blocker of properly querying the databases. From a functionality perspective I guess it's complete. Now I gotta:
- clean up the tests
 - refactor parts of the source
 - find additional optimization opportunities. I don't like the slow init.
 - document
 - tell the world it's done

Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-06-01 12:11:54 +02:00
Adam Rocska a1703d884e postpone...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 22:10:15 +02:00
Adam Rocska 4fe0745b4c Intentionally committing crap code.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 22:08:07 +02:00
Adam Rocska 7094fa0a5d Renamed the Index module to IndexReader in hope that it'll help me resolve this small generic issue I have here.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 20:34:28 +02:00
Adam Rocska 94b0ea8673 Temporary dummy code.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 20:29:48 +02:00
Adam Rocska 937587ed92 Simplified formatting.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 17:59:58 +02:00
Adam Rocska c073af2ec4 Renamed the Metadata internal module to MetadataReader. Hopefully it'll make imports a bit more comfortable.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 17:52:47 +02:00
Adam Rocska aa11b7c118 sonar scan trigger
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 17:02:25 +02:00
Adam Rocska 6cc0926362 Trying to get a grab on the bull's horn somehow.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 16:59:39 +02:00
Adam Rocska c28c6c640b Added dependencies in package swift. I still don't get it why did it compile, so I gotta look into this as well at some point.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 16:58:45 +02:00
Adam Rocska f92a0daf79 Impossible to design a protocol at this point. And there's just no way I would take that php scripter fantasy crap as the fundamentum for this lib, no matter how crippled already it is by inherited scripter stupidity.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 16:58:03 +02:00
Adam Rocska cb2b939085 Made DBReader interfaces public.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 16:56:05 +02:00
Adam Rocska 278e8b3efb Created & added a future plans doc' item to remind myself, and other potential readers on what's about to come.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 16:55:26 +02:00
Adam Rocska 9827635299 Added GeoLite DB files for testing purposes. Totally not cool for "unit" testing, but I gotta validate the concepts somehow. Tests will be refactored.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 16:54:59 +02:00
Adam Rocska 5da03ef59d DataBaseType enum for somehow handling the possiblly valid database metadata types.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-30 13:27:36 +02:00
Adam Rocska f4f5352c61 More specific imports. Dunno why.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 22:17:31 +02:00
Adam Rocska 0e44b9422e Provided a few dumb tests for InMemoryReader and I just realized, that it's not even specific to "in memory-ness". It should work with anything.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 22:16:04 +02:00
Adam Rocska f2b8c48df5 Reader protocol and foundations for DBReader's testability.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 21:37:38 +02:00
Adam Rocska 7a7664acc6 Found a way around this naming problem.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 20:54:26 +02:00
Adam Rocska b26f0cf0cf ReaderError.swift was no longer in use.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 20:54:08 +02:00
Adam Rocska bf5e436499 Filebased readers have a metadata property. Exposing it, and exposing the DbMetadata concept overaall.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 20:42:46 +02:00
Adam Rocska 26a3219960 Made the LICENSE stricter. After all this madness I don't want these mountebank php scripters forking and redistributing as their own.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 15:05:05 +02:00
Adam Rocska cd69a4a736 Removed old readme disclaimers. Will be properly documented once this misery ends.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 15:03:08 +02:00
Adam Rocska fe149cc237 Made the structs public, and created a protocol to allow for a slightly better API to work with maxmind's shitty php designed crap called "database".
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 14:54:55 +02:00
Adam Rocska c82765d9cd De-phpified ip addresses.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 14:12:32 +02:00
Adam Rocska 9a77a33c78 Forwarding internal module's IpAddress through Api.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 14:12:14 +02:00
Adam Rocska 0f83261f39 The initial port of the php retardness. Next I'll try to de-phpify this crap into a not-so-scrap state. It will eventually remain crappy because of the way it's "modelled" (or lack of modelling aactually).
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 12:41:10 +02:00
Adam Rocska 66b90935bc God knows what the difference between Records and Models are at this point. Starting off with a moderate reproduction of php scripter booboo in swift.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-29 12:06:25 +02:00
Adam Rocska 1974c1744d Removed maxmind "branding" from repository wherever it was legally possible.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-28 15:49:56 +02:00
Adam Rocska f3b1e5ceaf Put a primitive assertion in place just to hold my ass until the library comes together. Will make the tests professional & sexy at a later point.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-28 15:41:26 +02:00
Adam Rocska c7c3ab44db Ok, the repo is somewhat exploded at this point. BUT IT WORKS! Now I only gotta provide proper tests instead of the trashy ones, put together the reader & serializer, and represent this maxmind php fantasy crap with some nice Structs. And then the saga is over for now.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-28 14:23:26 +02:00
Adam Rocska d7387c8845 Able to decode sequential types
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-27 20:07:25 +02:00
Adam Rocska 7b40c52c9d Found a bug. I was an unattentive prick & assumed some clean logic in the definition size resolution algorithm. I shouldn't have. Now it's cool.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-27 15:26:33 +02:00
Adam Rocska c645dd40c4 Created the intentional duplicate of interpretArray. Intenional duplicate, because I know nothing about this php and perl scripter mountebank fantasy data type.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-27 09:44:54 +02:00