2020-11-25 13:01:53 +02:00
|
|
|
package encoding
|
|
|
|
|
|
|
|
import (
|
2020-12-04 03:36:16 +02:00
|
|
|
"github.com/xtls/xray-core/common/net"
|
|
|
|
"github.com/xtls/xray-core/common/protocol"
|
2020-11-25 13:01:53 +02:00
|
|
|
)
|
|
|
|
|
2020-12-04 03:36:16 +02:00
|
|
|
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
|
2020-11-25 13:01:53 +02:00
|
|
|
|
|
|
|
const (
|
|
|
|
Version = byte(1)
|
|
|
|
)
|
|
|
|
|
|
|
|
var addrParser = protocol.NewAddressParser(
|
|
|
|
protocol.AddressFamilyByte(byte(protocol.AddressTypeIPv4), net.AddressFamilyIPv4),
|
|
|
|
protocol.AddressFamilyByte(byte(protocol.AddressTypeDomain), net.AddressFamilyDomain),
|
|
|
|
protocol.AddressFamilyByte(byte(protocol.AddressTypeIPv6), net.AddressFamilyIPv6),
|
|
|
|
protocol.PortThenAddress(),
|
|
|
|
)
|