diff --git a/app/dispatcher/default.go b/app/dispatcher/default.go index 18d47302..7c22e05a 100644 --- a/app/dispatcher/default.go +++ b/app/dispatcher/default.go @@ -288,9 +288,10 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport. return } - accessMessage := log.AccessMessageFromContext(ctx) - if accessMessage != nil { - accessMessage.Detour = "[" + handler.Tag() + "]" + if accessMessage := log.AccessMessageFromContext(ctx); accessMessage != nil { + if tag := handler.Tag(); tag != "" { + accessMessage.Detour = tag + } log.Record(accessMessage) } diff --git a/azure-pipelines.template.yml b/azure-pipelines.template.yml index a982efbe..da062e07 100644 --- a/azure-pipelines.template.yml +++ b/azure-pipelines.template.yml @@ -9,7 +9,7 @@ jobs: - checkout: self - task: GoTool@0 inputs: - version: '1.14' + version: '1.13' - script: | go test -p 1 -v -timeout 30m ./... workingDirectory: '$(Build.SourcesDirectory)' diff --git a/common/buf/io.go b/common/buf/io.go index c74d71ed..2a4cd670 100644 --- a/common/buf/io.go +++ b/common/buf/io.go @@ -65,12 +65,7 @@ func NewReader(reader io.Reader) Reader { if err != nil { newError("failed to get sysconn").Base(err).WriteToLog() } else { - /* Check if ReadVReader Can be used on this reader first - Fix https://github.com/v2ray/v2ray-core/issues/1666 - */ - if ok, _ := checkReadVConstraint(rawConn); ok { - return NewReadVReader(reader, rawConn) - } + return NewReadVReader(reader, rawConn) } } } diff --git a/common/buf/readv_constraint_other.go b/common/buf/readv_constraint_other.go deleted file mode 100644 index 315ce61f..00000000 --- a/common/buf/readv_constraint_other.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build !windows - -package buf - -import "syscall" - -func checkReadVConstraint(conn syscall.RawConn) (bool, error) { - return true, nil -} diff --git a/common/buf/readv_constraint_windows.go b/common/buf/readv_constraint_windows.go deleted file mode 100644 index 193ccb16..00000000 --- a/common/buf/readv_constraint_windows.go +++ /dev/null @@ -1,41 +0,0 @@ -// +build windows -package buf - -import ( - "syscall" -) - -func checkReadVConstraint(conn syscall.RawConn) (bool, error) { - var isSocketReady = false - var reason error - /* - In Windows, WSARecv system call only support socket connection. - - It it required to check if the given fd is of a socket type - - Fix https://github.com/v2ray/v2ray-core/issues/1666 - - Additional Information: - https://docs.microsoft.com/en-us/windows/desktop/api/winsock2/nf-winsock2-wsarecv - https://docs.microsoft.com/en-us/windows/desktop/api/winsock/nf-winsock-getsockopt - https://docs.microsoft.com/en-us/windows/desktop/WinSock/sol-socket-socket-options - - */ - err := conn.Control(func(fd uintptr) { - var val [4]byte - var le = int32(len(val)) - err := syscall.Getsockopt(syscall.Handle(fd), syscall.SOL_SOCKET, syscall.SO_RCVBUF, &val[0], &le) - if err != nil { - isSocketReady = false - } else { - isSocketReady = true - } - reason = err - }) - - if err != nil { - return false, err - } - - return isSocketReady, reason -} diff --git a/common/log/access.go b/common/log/access.go index 88a50c6d..f3398b55 100644 --- a/common/log/access.go +++ b/common/log/access.go @@ -25,7 +25,8 @@ type AccessMessage struct { To interface{} Status AccessStatus Reason interface{} - Detour interface{} + Email string + Detour string } func (m *AccessMessage) String() string { @@ -36,8 +37,11 @@ func (m *AccessMessage) String() string { builder.WriteByte(' ') builder.WriteString(serial.ToString(m.To)) builder.WriteByte(' ') - builder.WriteString(serial.ToString(m.Detour)) - builder.WriteByte(' ') + if len(m.Detour) > 0 { + builder.WriteByte('[') + builder.WriteString(m.Detour) + builder.WriteString("] ") + } builder.WriteString(serial.ToString(m.Reason)) if len(m.Email) > 0 { diff --git a/infra/conf/command/command.go b/infra/conf/command/command.go index 532ba2b8..9f8c12d5 100644 --- a/infra/conf/command/command.go +++ b/infra/conf/command/command.go @@ -3,7 +3,6 @@ package command //go:generate errorgen import ( - "bufio" "os" "github.com/golang/protobuf/proto" @@ -28,7 +27,7 @@ func (c *ConfigCommand) Description() control.Description { } func (c *ConfigCommand) Execute(args []string) error { - pbConfig, err := serial.LoadJSONConfig(bufio.NewReader(os.Stdin)) + pbConfig, err := serial.LoadJSONConfig(os.Stdin) if err != nil { return newError("failed to parse json config").Base(err) } diff --git a/release/install-release.sh b/release/install-release.sh index 85284a10..f84f5cf7 100755 --- a/release/install-release.sh +++ b/release/install-release.sh @@ -447,7 +447,7 @@ main(){ RETVAL="$?" if [[ $RETVAL == 0 ]] && [[ "$FORCE" != "1" ]]; then colorEcho ${BLUE} "Latest version ${CUR_VER} is already installed." - if [[ "${ERROR_IF_UPTODATE}" == "1" ]]; then + if [ -n "${ERROR_IF_UPTODATE}" ]; then return 10 fi return diff --git a/release/user-package.sh b/release/user-package.sh index 8c6b3945..d0bef1c4 100755 --- a/release/user-package.sh +++ b/release/user-package.sh @@ -86,14 +86,6 @@ packtgzAbPath() { echo ">>> Generated: $ABPATH" } -packtgzAbPath() { - local ABPATH="$1" - echo ">>> Generating tgz package at $ABPATH" - pushd $TMP - tar cvfz $ABPATH . - echo ">>> Generated: $ABPATH" -} - pkg=zip nosource=0 @@ -169,7 +161,7 @@ if [[ $pkg == "zip" ]]; then elif [[ $pkg == "tgz" ]]; then packtgz else - packtgzAbPath $pkg + packtgzAbPath "$pkg" fi diff --git a/transport/internet/tls/config.go b/transport/internet/tls/config.go index 1d41ed4a..2cd25721 100644 --- a/transport/internet/tls/config.go +++ b/transport/internet/tls/config.go @@ -187,24 +187,8 @@ func (c *Config) GetTLSConfig(opts ...Option) *tls.Config { } if !c.AllowInsecureCiphers && len(config.CipherSuites) == 0 { - config.CipherSuites = []uint16{ - tls.TLS_AES_128_GCM_SHA256, - tls.TLS_AES_256_GCM_SHA384, - tls.TLS_CHACHA20_POLY1305_SHA256, - - tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, - tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, - tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, - tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, - tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, - tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, - tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, - tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, - tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, - tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, - tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, - tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, - } + // crypto/tls will use the proper ciphers + config.CipherSuites = nil } config.InsecureSkipVerify = c.AllowInsecure diff --git a/transport/internet/tls/tls13_workaround.go b/transport/internet/tls/tls13_workaround.go deleted file mode 100644 index fbc3a8b4..00000000 --- a/transport/internet/tls/tls13_workaround.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build !confonly - -package tls - -import ( - "os" - "strings" -) - -func init() { - // opt-in TLS 1.3 for Go1.12 - // TODO: remove this line when Go1.13 is released. - if !strings.Contains(os.Getenv("GODEBUG"), "tls13") { - _ = os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1") - } -}