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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
accessMessage := log.AccessMessageFromContext(ctx)
|
if accessMessage := log.AccessMessageFromContext(ctx); accessMessage != nil {
|
||||||
if accessMessage != nil {
|
if tag := handler.Tag(); tag != "" {
|
||||||
accessMessage.Detour = "[" + handler.Tag() + "]"
|
accessMessage.Detour = tag
|
||||||
|
}
|
||||||
log.Record(accessMessage)
|
log.Record(accessMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ jobs:
|
||||||
- checkout: self
|
- checkout: self
|
||||||
- task: GoTool@0
|
- task: GoTool@0
|
||||||
inputs:
|
inputs:
|
||||||
version: '1.14'
|
version: '1.13'
|
||||||
- script: |
|
- script: |
|
||||||
go test -p 1 -v -timeout 30m ./...
|
go test -p 1 -v -timeout 30m ./...
|
||||||
workingDirectory: '$(Build.SourcesDirectory)'
|
workingDirectory: '$(Build.SourcesDirectory)'
|
||||||
|
|
|
@ -65,15 +65,10 @@ func NewReader(reader io.Reader) Reader {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
newError("failed to get sysconn").Base(err).WriteToLog()
|
newError("failed to get sysconn").Base(err).WriteToLog()
|
||||||
} else {
|
} 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return &SingleReader{
|
return &SingleReader{
|
||||||
Reader: reader,
|
Reader: reader,
|
||||||
|
|
|
@ -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{}
|
To interface{}
|
||||||
Status AccessStatus
|
Status AccessStatus
|
||||||
Reason interface{}
|
Reason interface{}
|
||||||
Detour interface{}
|
Email string
|
||||||
|
Detour string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *AccessMessage) String() string {
|
func (m *AccessMessage) String() string {
|
||||||
|
@ -36,8 +37,11 @@ func (m *AccessMessage) String() string {
|
||||||
builder.WriteByte(' ')
|
builder.WriteByte(' ')
|
||||||
builder.WriteString(serial.ToString(m.To))
|
builder.WriteString(serial.ToString(m.To))
|
||||||
builder.WriteByte(' ')
|
builder.WriteByte(' ')
|
||||||
builder.WriteString(serial.ToString(m.Detour))
|
if len(m.Detour) > 0 {
|
||||||
builder.WriteByte(' ')
|
builder.WriteByte('[')
|
||||||
|
builder.WriteString(m.Detour)
|
||||||
|
builder.WriteString("] ")
|
||||||
|
}
|
||||||
builder.WriteString(serial.ToString(m.Reason))
|
builder.WriteString(serial.ToString(m.Reason))
|
||||||
|
|
||||||
if len(m.Email) > 0 {
|
if len(m.Email) > 0 {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package command
|
||||||
//go:generate errorgen
|
//go:generate errorgen
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
@ -28,7 +27,7 @@ func (c *ConfigCommand) Description() control.Description {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConfigCommand) Execute(args []string) error {
|
func (c *ConfigCommand) Execute(args []string) error {
|
||||||
pbConfig, err := serial.LoadJSONConfig(bufio.NewReader(os.Stdin))
|
pbConfig, err := serial.LoadJSONConfig(os.Stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return newError("failed to parse json config").Base(err)
|
return newError("failed to parse json config").Base(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,7 +447,7 @@ main(){
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
if [[ $RETVAL == 0 ]] && [[ "$FORCE" != "1" ]]; then
|
if [[ $RETVAL == 0 ]] && [[ "$FORCE" != "1" ]]; then
|
||||||
colorEcho ${BLUE} "Latest version ${CUR_VER} is already installed."
|
colorEcho ${BLUE} "Latest version ${CUR_VER} is already installed."
|
||||||
if [[ "${ERROR_IF_UPTODATE}" == "1" ]]; then
|
if [ -n "${ERROR_IF_UPTODATE}" ]; then
|
||||||
return 10
|
return 10
|
||||||
fi
|
fi
|
||||||
return
|
return
|
||||||
|
|
|
@ -86,14 +86,6 @@ packtgzAbPath() {
|
||||||
echo ">>> Generated: $ABPATH"
|
echo ">>> Generated: $ABPATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
packtgzAbPath() {
|
|
||||||
local ABPATH="$1"
|
|
||||||
echo ">>> Generating tgz package at $ABPATH"
|
|
||||||
pushd $TMP
|
|
||||||
tar cvfz $ABPATH .
|
|
||||||
echo ">>> Generated: $ABPATH"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pkg=zip
|
pkg=zip
|
||||||
nosource=0
|
nosource=0
|
||||||
|
@ -169,7 +161,7 @@ if [[ $pkg == "zip" ]]; then
|
||||||
elif [[ $pkg == "tgz" ]]; then
|
elif [[ $pkg == "tgz" ]]; then
|
||||||
packtgz
|
packtgz
|
||||||
else
|
else
|
||||||
packtgzAbPath $pkg
|
packtgzAbPath "$pkg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -187,24 +187,8 @@ func (c *Config) GetTLSConfig(opts ...Option) *tls.Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !c.AllowInsecureCiphers && len(config.CipherSuites) == 0 {
|
if !c.AllowInsecureCiphers && len(config.CipherSuites) == 0 {
|
||||||
config.CipherSuites = []uint16{
|
// crypto/tls will use the proper ciphers
|
||||||
tls.TLS_AES_128_GCM_SHA256,
|
config.CipherSuites = nil
|
||||||
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,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config.InsecureSkipVerify = c.AllowInsecure
|
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