mirror of https://github.com/v2ray/v2ray-core
Merge branch 'master' of github.com:/v2fly/v2ray-core
commit
c84e795518
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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)'
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
// +build !windows
|
||||
|
||||
package buf
|
||||
|
||||
import "syscall"
|
||||
|
||||
func checkReadVConstraint(conn syscall.RawConn) (bool, error) {
|
||||
return true, nil
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue