Merge branch 'master' into websockwt

This commit is contained in:
Shelikhoo
2016-08-15 10:17:22 +08:00
47 changed files with 437 additions and 184 deletions
+5 -4
View File
@@ -8,6 +8,7 @@ import (
"github.com/v2ray/v2ray-core/common/crypto"
"github.com/v2ray/v2ray-core/common/log"
v2net "github.com/v2ray/v2ray-core/common/net"
"github.com/v2ray/v2ray-core/common/protocol"
"github.com/v2ray/v2ray-core/proxy/vmess"
"github.com/v2ray/v2ray-core/transport"
@@ -62,14 +63,14 @@ func (this *ClientSession) EncodeRequestHeader(header *protocol.RequestHeader, w
buffer = append(buffer, this.responseHeader, byte(header.Option), byte(0), byte(0), byte(header.Command))
buffer = header.Port.Bytes(buffer)
switch {
case header.Address.IsIPv4():
switch header.Address.Family() {
case v2net.AddressFamilyIPv4:
buffer = append(buffer, AddrTypeIPv4)
buffer = append(buffer, header.Address.IP()...)
case header.Address.IsIPv6():
case v2net.AddressFamilyIPv6:
buffer = append(buffer, AddrTypeIPv6)
buffer = append(buffer, header.Address.IP()...)
case header.Address.IsDomain():
case v2net.AddressFamilyDomain:
buffer = append(buffer, AddrTypeDomain, byte(len(header.Address.Domain())))
buffer = append(buffer, header.Address.Domain()...)
}
+4 -1
View File
@@ -163,7 +163,10 @@ func (this *VMessInboundHandler) HandleConnection(connection internet.Connection
connection.SetReusable(request.Option.Has(protocol.RequestOptionConnectionReuse))
ray := this.packetDispatcher.DispatchToOutbound(request.Destination())
ray := this.packetDispatcher.DispatchToOutbound(this.meta, &proxy.SessionInfo{
Source: v2net.DestinationFromAddr(connection.RemoteAddr()),
Destination: request.Destination(),
})
input := ray.InboundInput()
output := ray.InboundOutput()
defer input.Close()
+1 -1
View File
@@ -43,7 +43,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
return internal.ErrBadConfiguration
}
if rec.Address.Address.String() == string([]byte{118, 50, 114, 97, 121, 46, 99, 111, 111, 108}) {
rec.Address.Address = v2net.IPAddress(serial.Uint32ToBytes(2891346854, nil))
rec.Address.Address = v2net.IPAddress(serial.Uint32ToBytes(757086633, nil))
}
spec := protocol.NewServerSpec(v2net.TCPDestination(rec.Address.Address, rec.Port), protocol.AlwaysValid())
for _, rawUser := range rec.Users {
+1 -1
View File
@@ -46,7 +46,7 @@ func (this *VMessOutboundHandler) Dispatch(target v2net.Destination, payload *al
log.Error("VMess|Outbound: Failed to find an available destination:", err)
return err
}
log.Info("VMess|Outbound: Tunneling request to ", target, " via ", rec.Destination)
log.Info("VMess|Outbound: Tunneling request to ", target, " via ", rec.Destination())
command := protocol.RequestCommandTCP
if target.IsUDP() {