Adam Rocska
75de094c7f
Committing the whole current state I have. I must apply few changes, and transition to Stream based processing (somehow).
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-08 12:15:36 +02:00
Adam Rocska
dfa9844ccd
Made the IpAddress custom string convertible.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-07 20:41:21 +02:00
Adam Rocska
c549114806
IPV4-mapped IPV6 address support added.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-07 19:50:19 +02:00
Adam Rocska
8b1f95ed7c
IPV4 can now be equality compared with IPV6
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-07 19:33:02 +02:00
Adam Rocska
7a921f62b6
IPV6 can now be constructed from IPV4
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-07 19:22:56 +02:00
Adam Rocska
deecce754f
Added initializer from Data.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-07 18:38:22 +02:00
Adam Rocska
4ffc0ae3a0
Added initializer from string.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-07 18:31:14 +02:00
Adam Rocska
a51a554958
Fixed the broken tests.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-07 18:18:49 +02:00
Adam Rocska
b5dd2f8693
IpAddress enum now also supports IPv6.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-07 17:47:52 +02:00
Adam Rocska
6d5156758b
Found a convenient way of handling ip addresses in the "non-php way", yet supporting comfort. It'll be great.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-07 15:44:18 +02:00
Adam Rocska
b01b12a00d
Work in progress. Trying to find a decent way of interpreting "binary search tree" of MMDB, when they allow "28 bits" sized records. Do the math.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-06 16:39:30 +02:00
Adam Rocska
f6ba8dc10f
Metadata can now be constructed of iterators as well, because why not. I see an organic design pattern emerge here.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-06 15:36:10 +02:00
Adam Rocska
8c68f0b72d
We can decode the metadata nicely.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-06 14:45:02 +02:00
Adam Rocska
a635323351
Removed todo test
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-06 11:20:32 +02:00
Adam Rocska
5600f50365
Extended the ControlByte struct to expose the encapsulated binary definition.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-06 11:18:36 +02:00
Adam Rocska
d13efc0387
Array decoder provided.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-06 09:46:20 +02:00
Adam Rocska
8c82b2d9fe
Made the MaxMindIterator's pointer a public read, private write field.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-05 19:04:28 +02:00
Adam Rocska
a3cfe00c0c
Forgot to commit the String decoder. It's not the most elegant approach, as it completely and consciously ignores little endian utf-8 strings, but I won't bother, as MaxMindDB is big endian so far. When there's time, it needs a proper implementation.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-05 19:03:52 +02:00
Adam Rocska
31cd94ba37
Forgot to commit this Numeric change. The naming most probably will still vary, but I again hve too many outstanding changes.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-05 19:02:44 +02:00
Adam Rocska
4a247352ca
MaxMind Any decoder. Partial implementation, lots of todos, but boy it's a good way to go from this dark cave.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-05 19:01:34 +02:00
Adam Rocska
dbafc06173
Removed dead code.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-05 13:35:15 +02:00
Adam Rocska
d71a736207
Decoder approach is kept.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-05 13:33:20 +02:00
Adam Rocska
a3eaa2b8c9
MaxMind Iterator is done.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-05 13:33:03 +02:00
Adam Rocska
f97ca19be5
Iterator in progress. The concept is good enough, just has to be polished.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-05 00:31:52 +02:00
Adam Rocska
017626c3a7
Added nextValue skeleton.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-04 21:08:27 +02:00
Adam Rocska
3f4914190d
A strategy emerged on how to process MaxMindDB data. May not be the best, but it could work.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-04 21:05:55 +02:00
Adam Rocska
6449c653b2
It works. The motto should still remain "RTFM". Signed integers arrive as two's complement instead of signed magnitude (duh).
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-04 15:24:44 +02:00
Adam Rocska
a9dd03de70
Simplified the inlined type cast state. Now it's time to try the integer sign part.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-04 10:52:44 +02:00
Adam Rocska
bee57f211a
Last try before dumping & preconditioning: Moved the typed value contruction into the padding & truncating functions. Here the integer signed cases could be handled properly.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-04 10:44:41 +02:00
Adam Rocska
438c0eca44
Doing a commit, to save the state. But will remove truncation logic at all, and just simply set a precondition. MaxMind's DB format could possible have an "overflow case" happen, but it just won't be supported.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-04 10:35:42 +02:00
Adam Rocska
9d34199730
I'll figure out int32 later.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-03 18:23:09 +02:00
Adam Rocska
9adc855359
Work in progress with the decoder. I want to avoid creating a copy in memory just because maxmind's binary data format sucks jack's shit...
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-03 17:41:57 +02:00
Adam Rocska
4ab4518902
Found some dead code.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-03 15:11:02 +02:00
Adam Rocska
1c8ead14ce
Can decode UInt16
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-03 14:15:15 +02:00
Adam Rocska
5be584cfbc
Reader will definitely face these errors.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-02 10:38:24 +02:00
Adam Rocska
24b54ec8cb
Minor variable renaming & formatting.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-02 10:36:58 +02:00
Adam Rocska
bac7cedd36
Renamed the file from SafeIndexOffset to LimitedIndex & its test. I think it's more expressive.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-02 10:32:59 +02:00
Adam Rocska
92806b035d
I really needed these limitedIndex accessors. I don't know if it's an anti-pattern with Swift or not, but I couldn't find another way around.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-02 10:30:17 +02:00
Adam Rocska
94465bb5f9
Added a field to ControlByte which expresses the definition's size.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 17:49:58 +02:00
Adam Rocska
ce17c62f90
Keep the code in the 80 char range.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 14:51:38 +02:00
Adam Rocska
322234151a
Made the code leaner, and removed a few unnecessary self references.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 14:51:09 +02:00
Adam Rocska
379b3d576c
Simplification step 1. One last piece of gunk to clear out.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 14:46:40 +02:00
Adam Rocska
09469628e3
The quick and dirty implementation for lastIndexOf. I'll make it a bit nicer (definitely not faster), and move on.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 14:37:30 +02:00
Adam Rocska
b581f12b4f
Just to be absolutely in sync with GitHub. This is just a sketch.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 13:44:26 +02:00
Adam Rocska
1f80a1ac6e
Syncing github repo with local experiments :
...
- Reader now has the data separator defined as is.
- removed dead dummy playground code from MetadataStructTest.swift
- started to work out a last index of concept (naïve one of-course)
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 13:35:24 +02:00
Adam Rocska
6d98c2d5ff
Added docs' to the control byte.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 13:12:01 +02:00
Adam Rocska
7fff4d7a13
Removed unnecessary comment.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 23:38:35 +02:00
Adam Rocska
7bde17165c
Source is good. Now let's make the tests faster and better.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 22:33:32 +02:00
Adam Rocska
927efa97f7
Half way done with the generalized solution. Tests are green. And I am proud.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 19:45:21 +02:00
Adam Rocska
c349a08525
Simplified sliceFrom value definition
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 18:47:00 +02:00
Adam Rocska
cbe43c1bc6
ControlByte payloadSize determined for values between 29 and 284. On to the next challenge.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 18:11:56 +02:00
Adam Rocska
934dadc269
ControlByte payloadSize determined for values smaller than 29. On to the next challenge.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 16:59:44 +02:00
Adam Rocska
7bc612efee
ControlByte constructor got changed, because the byte sequence is at least 1 byte, at most 5 bytes long.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 14:43:44 +02:00
Adam Rocska
b020fb2944
Finally got a concept on how to program this in a non-convoluted way.
...
- Extended UInt8 with a nice and juicy bitmask helper function
- Foundation for a ControlByte type
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 13:27:23 +02:00
Adam Rocska
5ee582ca93
Had the usual unnecessary header comment from CLion.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 19:37:33 +02:00
Adam Rocska
90a7e857ec
We for sure will need an enum for MaxMind DB data types.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 19:36:10 +02:00
Adam Rocska
c1c9c55d4f
New test data just found a bug. Fixed it.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 16:51:36 +02:00
Adam Rocska
e06afd3d7a
Making the tests & the API nicer.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 16:41:19 +02:00
Adam Rocska
028b7ae23d
Removed stray dead code.
...
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 16:13:48 +02:00
Adam Rocska
a98db16edb
Bugfixing in the search algorithm.
2020-04-29 15:53:22 +02:00
Adam Rocska
661125fc80
I was an inattentive prick, and misimplemented the algorithm. It works now.
2020-04-29 13:29:16 +02:00
Adam Rocska
c0dba1887b
Committing half made not working code to ask for some help. The search algorithm gets stuck at index 20990 as if it was an overflow, while it can't be an overflow, since it's a typealias for Int, and also, it's not a square number. Weird. Bughunting.
2020-04-29 13:03:10 +02:00
Adam Rocska
3173807987
Removed submodules, and doing stuff.
2020-04-28 11:08:31 +02:00
Adam Rocska
3c798fe572
I managed to make the "libmaxminddb" dir disappear.
2020-04-27 21:39:40 +02:00
Adam Rocska
4fc53d970c
I figured out what the problem was. I was an idiot in many ways :
...
- the submodule had an invalid detatched head commit hash. Dunno why.
- the package swift file defined a wrong version number for libmaxminddb. Moral of the story : don't be an ass.
- some leftover garbage from automake made me believe I was done
- potato
2020-04-27 21:27:28 +02:00
Adam Rocska
731ac6da87
Trying to resolve this header file issue.
2020-04-27 17:30:45 +02:00
Adam Rocska
b948d24911
Added "maxminddb_config.h" in the helper package, because "libmaxmind" has it built via automake autoreconf.
2020-04-27 16:45:40 +02:00
Adam Rocska
3b32769926
Initial Commit.
2020-04-27 15:25:09 +02:00