mirror of https://github.com/v2ray/v2ray-core
remove Port.Bytes()
parent
58e2ed3381
commit
ee489c95b3
|
@ -39,11 +39,6 @@ func (p Port) Value() uint16 {
|
|||
return uint16(p)
|
||||
}
|
||||
|
||||
// Bytes returns the correspoding bytes of a Port, in big endian order.
|
||||
func (p Port) Bytes(b []byte) []byte {
|
||||
return serial.Uint16ToBytes(p.Value(), b)
|
||||
}
|
||||
|
||||
// String returns the string presentation of a Port.
|
||||
func (p Port) String() string {
|
||||
return serial.Uint16ToString(p.Value())
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/task"
|
||||
"v2ray.com/core/common/vio"
|
||||
)
|
||||
|
||||
type AddressOption func(*AddressParser)
|
||||
|
@ -166,7 +167,7 @@ func (p *AddressParser) ReadAddressPort(buffer *buf.Buffer, input io.Reader) (ne
|
|||
}
|
||||
|
||||
func (p *AddressParser) writePort(writer io.Writer, port net.Port) error {
|
||||
return common.Error2(writer.Write(port.Bytes(nil)))
|
||||
return common.Error2(vio.WriteUint16(writer, port.Value()))
|
||||
}
|
||||
|
||||
func (p *AddressParser) writeAddress(writer io.Writer, address net.Address) error {
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"v2ray.com/core/common/protocol"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/common/uuid"
|
||||
"v2ray.com/core/common/vio"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -95,7 +96,7 @@ func (f *CommandSwitchAccountFactory) Marshal(command interface{}, writer io.Wri
|
|||
common.Must2(writer.Write([]byte(hostStr)))
|
||||
}
|
||||
|
||||
common.Must2(writer.Write(cmd.Port.Bytes(nil)))
|
||||
common.Must2(vio.WriteUint16(writer, cmd.Port.Value()))
|
||||
|
||||
idBytes := cmd.ID.Bytes()
|
||||
common.Must2(writer.Write(idBytes))
|
||||
|
|
Loading…
Reference in New Issue