Skip to content

Commit b13fdf3

Browse files
author
sipt
committed
Merge branch 'develop' into pr/58
# Conflicts: # controller/server.go # geo_ip.go # http.go # transport_channel.go
2 parents 7785de0 + b3ebdd9 commit b13fdf3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2065
-1476
lines changed

ciphers/ciphers.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package ciphers
22

33
import (
4-
"github.com/sipt/shuttle"
5-
"github.com/sipt/shuttle/ciphers/ssstream"
64
"fmt"
75
"github.com/sipt/shuttle/ciphers/ssaead"
6+
"github.com/sipt/shuttle/ciphers/ssstream"
7+
connect "github.com/sipt/shuttle/conn"
88
)
99

10-
type ConnDecorate func(password string, conn shuttle.IConn) (shuttle.IConn, error)
10+
type ConnDecorate func(password string, conn connect.IConn) (connect.IConn, error)
1111

1212
//加密装饰
13-
func CipherDecorate(password, method string, conn shuttle.IConn) (shuttle.IConn, error) {
13+
func CipherDecorate(password, method string, conn connect.IConn) (connect.IConn, error) {
1414
d := ssstream.GetStreamCiphers(method)
1515
if d != nil {
1616
return d(password, conn)

ciphers/ssaead/cipher_conn.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ package ssaead
33
import (
44
"crypto/cipher"
55
"crypto/sha1"
6+
connect "github.com/sipt/shuttle/conn"
67
"io"
78

8-
"golang.org/x/crypto/hkdf"
9-
"github.com/sipt/shuttle"
109
"bytes"
1110
"crypto/md5"
1211
"crypto/rand"
13-
"github.com/sipt/shuttle/pool"
1412
"github.com/sipt/shuttle/log"
13+
"github.com/sipt/shuttle/pool"
14+
"golang.org/x/crypto/hkdf"
1515
)
1616

1717
var aeadCiphers = make(map[string]IAEADCipher)
@@ -21,12 +21,12 @@ func registerAEADCiphers(method string, c IAEADCipher) {
2121
log.Logger.Infof("[SS Ciphers] register cipher [%s]", method)
2222
}
2323

24-
func GetAEADCiphers(method string) func(string, shuttle.IConn) (shuttle.IConn, error) {
24+
func GetAEADCiphers(method string) func(string, connect.IConn) (connect.IConn, error) {
2525
c, ok := aeadCiphers[method]
2626
if !ok {
2727
return nil
2828
}
29-
return func(password string, conn shuttle.IConn) (shuttle.IConn, error) {
29+
return func(password string, conn connect.IConn) (connect.IConn, error) {
3030
salt := make([]byte, c.SaltSize())
3131
if _, err := io.ReadFull(rand.Reader, salt); err != nil {
3232
return nil, err
@@ -57,7 +57,7 @@ type IAEADCipher interface {
5757
}
5858

5959
type aeadConn struct {
60-
shuttle.IConn
60+
connect.IConn
6161
IAEADCipher
6262
key []byte
6363
rNonce []byte

ciphers/ssstream/cipher_conn.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package ssstream
22

33
import (
4-
"github.com/sipt/shuttle"
5-
"github.com/sipt/shuttle/pool"
64
"crypto/cipher"
7-
"io"
8-
"crypto/rand"
95
"crypto/md5"
6+
"crypto/rand"
7+
connect "github.com/sipt/shuttle/conn"
108
"github.com/sipt/shuttle/log"
9+
"github.com/sipt/shuttle/pool"
10+
"io"
1111
)
1212

1313
var streamCiphers = make(map[string]IStreamCipher)
@@ -17,12 +17,12 @@ func registerStreamCiphers(method string, c IStreamCipher) {
1717
log.Logger.Infof("[SS Ciphers] register cipher [%s]", method)
1818
}
1919

20-
func GetStreamCiphers(method string) func(string, shuttle.IConn) (shuttle.IConn, error) {
20+
func GetStreamCiphers(method string) func(string, connect.IConn) (connect.IConn, error) {
2121
c, ok := streamCiphers[method]
2222
if !ok {
2323
return nil
2424
}
25-
return func(password string, conn shuttle.IConn) (shuttle.IConn, error) {
25+
return func(password string, conn connect.IConn) (connect.IConn, error) {
2626
iv := make([]byte, c.IVLen())
2727
if _, err := io.ReadFull(rand.Reader, iv); err != nil {
2828
return nil, err
@@ -47,7 +47,7 @@ type IStreamCipher interface {
4747
}
4848

4949
type streamConn struct {
50-
shuttle.IConn
50+
connect.IConn
5151
IStreamCipher
5252
key []byte
5353
Encrypter cipher.Stream

0 commit comments

Comments
 (0)