How to use v2 with secret from v1?
Kami-no opened this issue · 1 comments
Kami-no commented
Using non-hex version of secret and get error:
docker run --network=host --rm nineseconds/mtg:2 simple-run 0.0.0.0:8080 d9...
mtg: error: incorrect secret: incorrect first byte of secret: 0xd9
or
echo -n d9... | base64
ZD...
docker run --network=host --rm nineseconds/mtg:2 simple-run 0.0.0.0:8080 ZD...
mtg: error: incorrect secret: incorrect secret format: illegal base64 data at input byte 43
PS: you can't use bind ":8080":
docker run --network=host --rm nineseconds/mtg:2 simple-run :8080 ZD...
mtg: error: incorrect bind-to parameter: empty host: :8080
9seconds commented
Please check this description: https://github.com/9seconds/mtg/blob/master/mtglib/secret.go#L16-L40
Roughly speaking MTRPOTO proxy secret is bytes that are prefixed in a special way. If first byte is 0xee
(an only type of secrets supported by mtg), then it is a FakeTLS secret.
This array of bytes is serialized in 2 ways:
- Hex (that's why you see
ee
prefix, because this is how 0x00 is encoded in hex by definition) - Base64
What you do here is you have some secret in hex and you want to use it. This secret I expect is present as hex. So, if you prepend ee
to it, then it should be a valid one: eed9...
but also please remember that hostname is also appended to 16 bytes of secret.