1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-08 06:46:07 -04:00

Add Port as a type

This commit is contained in:
V2Ray
2015-12-02 12:47:54 +01:00
parent e8e6cf1429
commit cee85bdf26
16 changed files with 125 additions and 98 deletions

View File

@@ -34,7 +34,7 @@ func (request *Socks5UDPRequest) Write(buffer *alloc.Buffer) {
case request.Address.IsDomain():
buffer.AppendBytes(AddrTypeDomain, byte(len(request.Address.Domain()))).Append([]byte(request.Address.Domain()))
}
buffer.Append(request.Address.PortBytes())
buffer.Append(request.Address.Port().Bytes())
buffer.Append(request.Data.Value)
}

View File

@@ -193,7 +193,7 @@ func (this *SocksServer) handleUDP(reader *v2net.TimeOutReader, writer io.Writer
udpAddr := this.getUDPAddr()
response.Port = udpAddr.Port()
response.Port = udpAddr.Port().Value()
switch {
case udpAddr.IsIPv4():
response.SetIPv4(udpAddr.IP())

View File

@@ -172,7 +172,7 @@ func (this *VMessRequest) ToBytes(idHash user.CounterHash, randomRangeInt64 user
buffer.Append(this.RequestKey)
buffer.Append(this.ResponseHeader)
buffer.AppendBytes(this.Command)
buffer.Append(this.Address.PortBytes())
buffer.Append(this.Address.Port().Bytes())
switch {
case this.Address.IsIPv4():