Obfuscator interface in core & relay/proxy CLI support

This commit is contained in:
Toby
2020-04-23 14:43:12 -07:00
parent c441afea35
commit 5ebe556d8d
11 changed files with 145 additions and 7 deletions

20
pkg/obfs/xor.go Normal file
View File

@@ -0,0 +1,20 @@
package obfs
type XORObfuscator []byte
func (x XORObfuscator) Deobfuscate(buf []byte, n int) int {
l := len(x)
for i := range buf {
buf[i] ^= x[i%l]
}
return n
}
func (x XORObfuscator) Obfuscate(p []byte) []byte {
np := make([]byte, len(p))
l := len(x)
for i := range p {
np[i] = p[i] ^ x[i%l]
}
return np
}