Consider adding MarshalJson support for ClientHelloSpec
Hi! Looks like utls can unmarshal ClientHelloSpec from client.tlsfingerprint.io format
Could be useful to support marshalling/unmarshalling to/from arbitrary json, or at least marshalling to client.tlsfingerprint.io format
Actually JSON import/export was a planned feature. But currently only partially completed due to my limited capacity. I want to clarify that it is not abandoned or deserted, but still "coming soon".
client.tlsfingerprint.io format
I would love to point out that client.tlsfingerprint.io currently does not parse enough details and what's provided there could be less than enough to rebuild a complete ClientHelloSpec when a few new extensions are included (PSK, ALPS, etc). You can see in testdata we have some pre-built JSON which does not look like the response from client.tlsfingerprint.io. Those are actually the proposed JSON ClientHelloSpec.
With that said, I guess we all would be happy to see if anyone volunteers to take over the development of this feature.
Do we need to keep compatibility with client.tlsfingerprint.io? It's json and would complicate adding normal readable json support(current impl of client.tlsfingerprint.io expects binary data in extensions ) afaik
Importing from client.tlsfingerprint.io was (supposed to be) done by (*ClientHelloSpec).ImportTLSClientHello. It will no longer work now given the client.tlsfingerprint.io has been changed (moved to use clienthellod), but the corresponding updates are welcome.
But again clienthellod doesn't capture every single details in the clienthello either so I doubt if you can really build a complete ClientHelloSpec from what you see on client.tlsfingerprint.io.
So, in short, no. JSON here does not refer to client.tlsfingerprint.io, and should not be compatible with it. The original plan is building a JSON-exporter to replace the old UTLS code generator on tlsfingerprint.io.