github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/transport/internet/tls/utls/nameMapper.go (about)

     1  package utls
     2  
     3  import utls "github.com/refraction-networking/utls"
     4  
     5  var clientHelloIDMap = map[string]*utls.ClientHelloID{
     6  	"randomized":        &utls.HelloRandomized,
     7  	"randomizedalpn":    &utls.HelloRandomizedALPN,
     8  	"randomizednoalpn":  &utls.HelloRandomizedNoALPN,
     9  	"firefox_auto":      &utls.HelloFirefox_Auto,
    10  	"firefox_55":        &utls.HelloFirefox_55,
    11  	"firefox_56":        &utls.HelloFirefox_56,
    12  	"firefox_63":        &utls.HelloFirefox_63,
    13  	"firefox_65":        &utls.HelloFirefox_65,
    14  	"firefox_99":        &utls.HelloFirefox_99,
    15  	"firefox_102":       &utls.HelloFirefox_102,
    16  	"firefox_105":       &utls.HelloFirefox_105,
    17  	"chrome_auto":       &utls.HelloChrome_Auto,
    18  	"chrome_58":         &utls.HelloChrome_58,
    19  	"chrome_62":         &utls.HelloChrome_62,
    20  	"chrome_70":         &utls.HelloChrome_70,
    21  	"chrome_72":         &utls.HelloChrome_72,
    22  	"chrome_83":         &utls.HelloChrome_83,
    23  	"chrome_87":         &utls.HelloChrome_87,
    24  	"chrome_96":         &utls.HelloChrome_96,
    25  	"chrome_100":        &utls.HelloChrome_100,
    26  	"chrome_102":        &utls.HelloChrome_102,
    27  	"ios_auto":          &utls.HelloIOS_Auto,
    28  	"ios_11_1":          &utls.HelloIOS_11_1,
    29  	"ios_12_1":          &utls.HelloIOS_12_1,
    30  	"ios_13":            &utls.HelloIOS_13,
    31  	"ios_14":            &utls.HelloIOS_14,
    32  	"android_11_okhttp": &utls.HelloAndroid_11_OkHttp,
    33  	"edge_auto":         &utls.HelloEdge_Auto,
    34  	"edge_85":           &utls.HelloEdge_85,
    35  	"edge_106":          &utls.HelloEdge_106,
    36  	"safari_auto":       &utls.HelloSafari_Auto,
    37  	"safari_16_0":       &utls.HelloSafari_16_0,
    38  	"360_auto":          &utls.Hello360_Auto,
    39  	"360_7_5":           &utls.Hello360_7_5,
    40  	"360_11_0":          &utls.Hello360_11_0,
    41  	"qq_auto":           &utls.HelloQQ_Auto,
    42  	"qq_11_1":           &utls.HelloQQ_11_1,
    43  }
    44  
    45  func nameToUTLSPreset(name string) (*utls.ClientHelloID, error) {
    46  	preset, ok := clientHelloIDMap[name]
    47  	if !ok {
    48  		return nil, newError("unknown preset name")
    49  	}
    50  	return preset, nil
    51  }