mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-04 20:37:40 +03:00
Add shadowboom
This commit is contained in:
parent
5cc189a169
commit
f63868bf82
30 changed files with 1923 additions and 147 deletions
|
@ -3,17 +3,16 @@ package shadowsocks
|
|||
import (
|
||||
"crypto/md5"
|
||||
"crypto/sha1"
|
||||
"hash/crc32"
|
||||
"io"
|
||||
"math/rand"
|
||||
|
||||
"golang.org/x/crypto/hkdf"
|
||||
"sing/common"
|
||||
"sing/common/socksaddr"
|
||||
)
|
||||
|
||||
const (
|
||||
MaxPacketSize = 16*1024 - 1
|
||||
PacketLengthBufferSize = 2
|
||||
)
|
||||
const MaxPacketSize = 16*1024 - 1
|
||||
|
||||
func Kdf(key, iv []byte, keyLength int) []byte {
|
||||
subKey := make([]byte, keyLength)
|
||||
|
@ -44,6 +43,14 @@ func Key(password []byte, keySize int) []byte {
|
|||
return m[:keySize]
|
||||
}
|
||||
|
||||
func RemapToPrintable(input []byte) {
|
||||
const charSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_`{|}~\\\""
|
||||
seed := rand.New(rand.NewSource(int64(crc32.ChecksumIEEE(input))))
|
||||
for i := range input {
|
||||
input[i] = charSet[seed.Intn(len(charSet))]
|
||||
}
|
||||
}
|
||||
|
||||
var AddressSerializer = socksaddr.NewSerializer(
|
||||
socksaddr.AddressFamilyByte(0x01, socksaddr.AddressFamilyIPv4),
|
||||
socksaddr.AddressFamilyByte(0x04, socksaddr.AddressFamilyIPv6),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue