-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from 9seconds/go118
Support of Go 1.18
- Loading branch information
Showing
20 changed files
with
335 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/9seconds/mtg/v2 | ||
|
||
go 1.17 | ||
go 1.18 | ||
|
||
require ( | ||
github.com/OneOfOne/xxhash v1.2.8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package faketls_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/9seconds/mtg/v2/mtglib/internal/faketls" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
var FuzzClientHelloSecret = []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} | ||
|
||
func FuzzClientHello(f *testing.F) { | ||
f.Add([]byte{1, 2, 3}) | ||
|
||
f.Fuzz(func(t *testing.T, frame []byte) { | ||
_, err := faketls.ParseClientHello(FuzzClientHelloSecret, frame) | ||
|
||
// a probability of having != err is almost negligible | ||
require.Error(t, err) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
mtglib/internal/obfuscated2/client_handshake_fuzz_internal_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package obfuscated2 | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
var FuzzClientHandshakeSecret = []byte{1, 2, 3} | ||
|
||
func FuzzClientHandshake(f *testing.F) { | ||
f.Add([]byte{1, 2, 3}) | ||
|
||
f.Fuzz(func(t *testing.T, frame []byte) { | ||
data := bytes.NewReader(frame) | ||
|
||
if _, _, _, err := ClientHandshake(FuzzClientHandshakeSecret, data); err != nil { | ||
return | ||
} | ||
|
||
handshake := clientHandhakeFrame{} | ||
require.Len(t, frame, handshakeFrameLen) | ||
|
||
copy(handshake.data[:], frame) | ||
|
||
decryptor := handshake.decryptor(FuzzClientHandshakeSecret) | ||
decryptor.XORKeyStream(handshake.data[:], handshake.data[:]) | ||
|
||
require.Equal(t, handshakeConnectionType, handshake.connectionType()) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.