<commit_before>package conf

import (
	"strings"

	"github.com/golang/protobuf/proto"

	"v2ray.com/core/common/protocol"
	"v2ray.com/core/common/serial"
	"v2ray.com/core/proxy/shadowsocks"
)

func cipherFromString(c string) shadowsocks.CipherType {
	switch strings.ToLower(c) {
	case "aes-256-cfb":
		return shadowsocks.CipherType_AES_256_CFB
	case "aes-128-cfb":
		return shadowsocks.CipherType_AES_128_CFB
	case "chacha20":
		return shadowsocks.CipherType_CHACHA20
	case "chacha20-ietf":
		return shadowsocks.CipherType_CHACHA20_IETF
	case "aes-128-gcm", "aead_aes_128_gcm":
		return shadowsocks.CipherType_AES_128_GCM
	case "aes-256-gcm", "aead_aes_256_gcm":
		return shadowsocks.CipherType_AES_256_GCM
	case "chacha20-poly1305", "aead_chacha20_poly1305", "chacha20-ietf-poly1305":
		return shadowsocks.CipherType_CHACHA20_POLY1305
	default:
		return shadowsocks.CipherType_UNKNOWN
	}
}

type ShadowsocksServerConfig struct {
	Cipher      string       `json:"method"`
	Password    string       `json:"password"`
	UDP         bool         `json:"udp"`
	Level       byte         `json:"level"`
	Email       string       `json:"email"`
	OTA         *bool        `json:"ota"`
	NetworkList *NetworkList `json:"network"`
}

func (v *ShadowsocksServerConfig) Build() (proto.Message, error) {
	config := new(shadowsocks.ServerConfig)
	config.UdpEnabled = v.UDP
	config.Network = v.NetworkList.Build()

	if v.Password == "" {
		return nil, newError("Shadowsocks password is not specified.")<commit_msg>Fix parser for shadowsocks cipher none<commit_after>package conf

import (
	"strings"

	"github.com/golang/protobuf/proto"

	"v2ray.com/core/common/protocol"
	"v2ray.com/core/common/serial"
	"v2ray.com/core/proxy/shadowsocks"
)

func cipherFromString(c string) shadowsocks.CipherType {
	switch strings.ToLower(c) {
	case "aes-256-cfb":
		return shadowsocks.CipherType_AES_256_CFB
	case "aes-128-cfb":
		return shadowsocks.CipherType_AES_128_CFB
	case "chacha20":
		return shadowsocks.CipherType_CHACHA20
	case "chacha20-ietf":
		return shadowsocks.CipherType_CHACHA20_IETF
	case "aes-128-gcm", "aead_aes_128_gcm":
		return shadowsocks.CipherType_AES_128_GCM
	case "aes-256-gcm", "aead_aes_256_gcm":
		return shadowsocks.CipherType_AES_256_GCM
	case "chacha20-poly1305", "aead_chacha20_poly1305", "chacha20-ietf-poly1305":
		return shadowsocks.CipherType_CHACHA20_POLY1305
	case "none", "plain":
		return shadowsocks.CipherType_NONE
	default:
		return shadowsocks.CipherType_UNKNOWN
	}
}

type ShadowsocksServerConfig struct {
	Cipher      string       `json:"method"`
	Password    string       `json:"password"`
	UDP         bool         `json:"udp"`
	Level       byte         `json:"level"`
	Email       string       `json:"email"`
	OTA         *bool        `json:"ota"`
	NetworkList *NetworkList `json:"network"`
}

func (v *ShadowsocksServerConfig) Build() (proto.Message, error) {
	config := new(shadowsocks.ServerConfig)
	config.UdpEnabled = v.UDP
	config.Network = v.NetworkList.Build()

	if v.Password == "" {
		return nil, newError("Shadowsocks password is not specified.")
{'fraction_non_alphanumeric': 0.11277218069548262, 'fraction_numerical': 0.04224894377640559, 'mean_word_length': 4.29776247848537, 'pattern_counts': {'":': 15, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4407762', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1114, 'n_words': 197}