mirror of https://github.com/v2ray/v2ray-core
				
				
				
			fix #351
							parent
							
								
									84978a501d
								
							
						
					
					
						commit
						1e5061f15e
					
				| 
						 | 
				
			
			@ -31,7 +31,7 @@ func (v *Account) GetCipher() (Cipher, error) {
 | 
			
		|||
		return &AesCfb{KeyBytes: 32}, nil
 | 
			
		||||
	case CipherType_CHACHA20:
 | 
			
		||||
		return &ChaCha20{IVBytes: 8}, nil
 | 
			
		||||
	case CipherType_CHACHA20_IEFT:
 | 
			
		||||
	case CipherType_CHACHA20_IETF:
 | 
			
		||||
		return &ChaCha20{IVBytes: 12}, nil
 | 
			
		||||
	default:
 | 
			
		||||
		return nil, errors.New("Unsupported cipher.")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ const (
 | 
			
		|||
	CipherType_AES_128_CFB   CipherType = 1
 | 
			
		||||
	CipherType_AES_256_CFB   CipherType = 2
 | 
			
		||||
	CipherType_CHACHA20      CipherType = 3
 | 
			
		||||
	CipherType_CHACHA20_IEFT CipherType = 4
 | 
			
		||||
	CipherType_CHACHA20_IETF CipherType = 4
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var CipherType_name = map[int32]string{
 | 
			
		||||
| 
						 | 
				
			
			@ -47,14 +47,14 @@ var CipherType_name = map[int32]string{
 | 
			
		|||
	1: "AES_128_CFB",
 | 
			
		||||
	2: "AES_256_CFB",
 | 
			
		||||
	3: "CHACHA20",
 | 
			
		||||
	4: "CHACHA20_IEFT",
 | 
			
		||||
	4: "CHACHA20_IETF",
 | 
			
		||||
}
 | 
			
		||||
var CipherType_value = map[string]int32{
 | 
			
		||||
	"UNKNOWN":       0,
 | 
			
		||||
	"AES_128_CFB":   1,
 | 
			
		||||
	"AES_256_CFB":   2,
 | 
			
		||||
	"CHACHA20":      3,
 | 
			
		||||
	"CHACHA20_IEFT": 4,
 | 
			
		||||
	"CHACHA20_IETF": 4,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x CipherType) String() string {
 | 
			
		||||
| 
						 | 
				
			
			@ -194,8 +194,8 @@ var fileDescriptor0 = []byte{
 | 
			
		|||
	0x36, 0xcc, 0x93, 0xaf, 0x00, 0x8f, 0x6d, 0x36, 0xa9, 0x6e, 0xe6, 0x1f, 0xe6, 0x57, 0x9f, 0xe6,
 | 
			
		||||
	0xee, 0x01, 0x7d, 0x0a, 0x24, 0x98, 0x2d, 0xe2, 0x33, 0xfe, 0x2e, 0x0e, 0xcf, 0xa7, 0xae, 0xb3,
 | 
			
		||||
	0x5d, 0xf0, 0x37, 0x6f, 0xed, 0xa2, 0xd3, 0x54, 0x12, 0x5e, 0x04, 0xe1, 0x45, 0xc0, 0x4f, 0xdd,
 | 
			
		||||
	0x2e, 0x7d, 0x06, 0xff, 0x6f, 0xa7, 0xf8, 0x72, 0x76, 0xbe, 0x74, 0x7b, 0xd3, 0x2f, 0xe0, 0x09,
 | 
			
		||||
	0x2e, 0x7d, 0x06, 0xff, 0x6f, 0xa7, 0xf8, 0x72, 0xb6, 0x3c, 0x77, 0x7b, 0xd3, 0x2f, 0xe0, 0x09,
 | 
			
		||||
	0xcc, 0xf7, 0xbe, 0xc4, 0x94, 0xb4, 0x69, 0xae, 0x1b, 0xa3, 0x9f, 0xc9, 0xce, 0xe5, 0x57, 0xe7,
 | 
			
		||||
	0xf8, 0x23, 0x8f, 0x92, 0x9a, 0x85, 0x0d, 0xf1, 0xda, 0x12, 0x17, 0x8f, 0xe7, 0xdb, 0x43, 0x9b,
 | 
			
		||||
	0xed, 0xd5, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0xb9, 0x5c, 0xee, 0x14, 0x03, 0x00, 0x00,
 | 
			
		||||
	0xed, 0xd5, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1b, 0x4e, 0xca, 0xdc, 0x14, 0x03, 0x00, 0x00,
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ enum CipherType {
 | 
			
		|||
  AES_128_CFB = 1;
 | 
			
		||||
  AES_256_CFB = 2;
 | 
			
		||||
  CHACHA20 = 3;
 | 
			
		||||
  CHACHA20_IEFT = 4;
 | 
			
		||||
  CHACHA20_IETF = 4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message ServerConfig {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -84,7 +84,7 @@ func TestUDPReaderWriter(t *testing.T) {
 | 
			
		|||
	user := &protocol.User{
 | 
			
		||||
		Account: serial.ToTypedMessage(&Account{
 | 
			
		||||
			Password:   "test-password",
 | 
			
		||||
			CipherType: CipherType_CHACHA20_IEFT,
 | 
			
		||||
			CipherType: CipherType_CHACHA20_IETF,
 | 
			
		||||
		}),
 | 
			
		||||
	}
 | 
			
		||||
	cache := buf.New()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@ package conf
 | 
			
		|||
 | 
			
		||||
import (
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"v2ray.com/core/common/errors"
 | 
			
		||||
	"v2ray.com/core/common/protocol"
 | 
			
		||||
	"v2ray.com/core/common/serial"
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +45,7 @@ func (v *ShadowsocksServerConfig) Build() (*serial.TypedMessage, error) {
 | 
			
		|||
	case "chacha20":
 | 
			
		||||
		account.CipherType = shadowsocks.CipherType_CHACHA20
 | 
			
		||||
	case "chacha20-ietf":
 | 
			
		||||
		account.CipherType = shadowsocks.CipherType_CHACHA20_IEFT
 | 
			
		||||
		account.CipherType = shadowsocks.CipherType_CHACHA20_IETF
 | 
			
		||||
	default:
 | 
			
		||||
		return nil, errors.New("Unknown cipher method: " + cipher)
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -105,7 +106,7 @@ func (v *ShadowsocksClientConfig) Build() (*serial.TypedMessage, error) {
 | 
			
		|||
		case "chacha20":
 | 
			
		||||
			account.CipherType = shadowsocks.CipherType_CHACHA20
 | 
			
		||||
		case "chacha20-ietf":
 | 
			
		||||
			account.CipherType = shadowsocks.CipherType_CHACHA20_IEFT
 | 
			
		||||
			account.CipherType = shadowsocks.CipherType_CHACHA20_IETF
 | 
			
		||||
		default:
 | 
			
		||||
			return nil, errors.New("Unknown cipher method: " + cipher)
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue