dedbox
2017-12-11 22:21:26

This looks related to the conversation in #general , so I added my 2 cents over there.


dedbox
2017-12-11 22:21:45

about concurrency trickery


dedbox
2017-12-11 22:22:38

@notjack I’ve got authoritys “working” in axon.


dedbox
2017-12-11 22:23:15

And some practical insights, hopefully.


dedbox
2017-12-11 22:24:56

The objective was to implement just barely enough of net2 to change this: (define (tcp-client make-codec [remote '("localhost" 3600)]) (define σ (apply-values (apply tcp-connect server-addr) codec-factory)) into this: (define (tcp-client make-codec [remote (authority "localhost.:3600")]) (define host (authority-host remote)) (define port (authority-port remote)) (define σ (apply-values (tcp-connect host port) make-codec))


dedbox
2017-12-11 22:39:07

So now I have regexp parsers for IPv4address, IP-literal (except IPvFuture), and reg-name, lifted from the grammar in RFC 3986.


dedbox
2017-12-11 22:39:42

and I can create ip4, ip6, and dns instances and package them in an authority


dedbox
2017-12-11 22:42:07

I needed a lot of string-> and ->string functions internally.


dedbox
2017-12-11 22:45:54

My authority constructor take a string argument, since it’s convenient. I’d also like the other exported constructors to work the same.


dedbox
2017-12-11 22:49:36

I don’t really understand the point of storing labels as length-prefixed byte strings, or the dns-root-label.


notjack
2017-12-11 22:51:28

@dedbox fantastic, hopefully the parsing code can be moved/copied to net2 pretty easily


notjack
2017-12-11 22:51:40

the labels and root thing is because DNS names are very strange


notjack
2017-12-11 22:52:18

there’s two specs - one spec defines what names are possible, and the other defines what subset of those names are “well behaved”


notjack
2017-12-11 22:53:05

basically the URI RFC has a SHOULD rule that says reg-name values should be those well behaved names, but technically any name at all can be included via percent encoding


notjack
2017-12-11 22:53:28

the possible names are basically “anything at all joined with dots”


notjack
2017-12-11 22:53:36

you can stick unprintable bytes in dns names…


dedbox
2017-12-11 23:00:17

Where should I stick this code so you can see it?


notjack
2017-12-11 23:00:58

the axon repo you linked originally seems like a decent place


dedbox
2017-12-11 23:01:17

The axon part is like 4 lines.


dedbox
2017-12-11 23:01:31

Everything else is in net2/data.


notjack
2017-12-11 23:01:52

oh! a pull request to net2 then? haven’t set up any CI stuff yet though


dedbox
2017-12-11 23:01:53

I could stick the data.rkt file in the axon repo


notjack
2017-12-11 23:03:26

that could also work, at least as a holding place while CI is set up



notjack
2017-12-11 23:06:46

fantastic


dedbox
2017-12-11 23:07:30

:laughing:


dedbox
2017-12-11 23:08:07

I’m particularly proud of all the regexp gymnastics.


notjack
2017-12-11 23:08:57

good old regexps - the only reliable way to stick a parser in a spec


dedbox
2017-12-11 23:09:42

For kicks, here’s the actual regexp being generated: (?:^((?:\[(?:(?:(?:(?:(?:[0-9A-F]{1,4}):){6})(?:(?:(?:[0-9A-F]{1,4}):)(?:[0-9A-F]{1,4})\|(?:(?:[0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5])(?:\.(?:[0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5])){3}))\|::(?:(?:(?:[0-9A-F]{1,4}):){5})(?:(?:(?:[0-9A-F]{1,4}):)(?:[0-9A-F]{1,4})\|(?:(?:[0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5])(?:\.(?:[0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5])){3}))\|(?:[0-9A-F]{1,4})?::(?:(?:(?:[0-9A-F]{1,4}):){4})(?:(?:(?:[0-9A-F]{1,4}):)(?:[0-9A-F]{1,4})\|(?:(?:[0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5])(?:\.(?:[0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5])){3}))\|(?:(?:(?:(?:[0-9A-F]{1,4}):){,1})(?:[0-9A-F]{1,4}))?::(?:(?:(?:[0-9A-F]{1,4}):){3})(?:(?:(?:[0-9A-F]{1,4}):)(?:[0-9A-F]{1,4})\|(?:(?:[0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5])(?:\.(?:[0-9]\|[1-9][0-9]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\|[0-9]\|[-._~])\|(?:%[0-9A-F][0-9A-F])\|[!$&'()*+,;=])+))(?::([0-9]+))?)


notjack
2017-12-11 23:09:58

dang


dedbox
2017-12-11 23:10:18

1954 characters. I hope Racket can handle that.