mirror of https://github.com/v2ray/v2ray-core
remove use of 'v' as a variable name
parent
77e1427845
commit
d00f8eef56
|
@ -6,9 +6,9 @@ import (
|
||||||
"v2ray.com/core/common/log"
|
"v2ray.com/core/common/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (this *Config) GetInternalHosts() map[string]net.IP {
|
func (v *Config) GetInternalHosts() map[string]net.IP {
|
||||||
hosts := make(map[string]net.IP)
|
hosts := make(map[string]net.IP)
|
||||||
for domain, ipOrDomain := range this.GetHosts() {
|
for domain, ipOrDomain := range v.GetHosts() {
|
||||||
address := ipOrDomain.AsAddress()
|
address := ipOrDomain.AsAddress()
|
||||||
if address.Family().IsDomain() {
|
if address.Family().IsDomain() {
|
||||||
log.Warning("DNS: Ignoring domain address in static hosts: ", address.Domain())
|
log.Warning("DNS: Ignoring domain address in static hosts: ", address.Domain())
|
||||||
|
|
|
@ -77,13 +77,13 @@ func (b *Buffer) AppendString(s string) *Buffer {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Buffer) AppendUint16(v uint16) *Buffer {
|
func (b *Buffer) AppendUint16(val uint16) *Buffer {
|
||||||
b.Value = serial.Uint16ToBytes(v, b.Value)
|
b.Value = serial.Uint16ToBytes(val, b.Value)
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Buffer) AppendUint32(v uint32) *Buffer {
|
func (b *Buffer) AppendUint32(val uint32) *Buffer {
|
||||||
b.Value = serial.Uint32ToBytes(v, b.Value)
|
b.Value = serial.Uint32ToBytes(val, b.Value)
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,15 +99,15 @@ func (b *Buffer) PrependBytes(data ...byte) *Buffer {
|
||||||
return b.Prepend(data)
|
return b.Prepend(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Buffer) PrependUint16(v uint16) *Buffer {
|
func (b *Buffer) PrependUint16(val uint16) *Buffer {
|
||||||
b.SliceBack(2)
|
b.SliceBack(2)
|
||||||
serial.Uint16ToBytes(v, b.Value[:0])
|
serial.Uint16ToBytes(val, b.Value[:0])
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Buffer) PrependUint32(v uint32) *Buffer {
|
func (b *Buffer) PrependUint32(val uint32) *Buffer {
|
||||||
b.SliceBack(4)
|
b.SliceBack(4)
|
||||||
serial.Uint32ToBytes(v, b.Value[:0])
|
serial.Uint32ToBytes(val, b.Value[:0])
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,34 +46,34 @@ func InitErrorLogger(file string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug outputs a debug log with given format and optional arguments.
|
// Debug outputs a debug log with given format and optional arguments.
|
||||||
func Debug(v ...interface{}) {
|
func Debug(val ...interface{}) {
|
||||||
debugLogger.Log(&internal.ErrorLog{
|
debugLogger.Log(&internal.ErrorLog{
|
||||||
Prefix: "[Debug]",
|
Prefix: "[Debug]",
|
||||||
Values: v,
|
Values: val,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info outputs an info log with given format and optional arguments.
|
// Info outputs an info log with given format and optional arguments.
|
||||||
func Info(v ...interface{}) {
|
func Info(val ...interface{}) {
|
||||||
infoLogger.Log(&internal.ErrorLog{
|
infoLogger.Log(&internal.ErrorLog{
|
||||||
Prefix: "[Info]",
|
Prefix: "[Info]",
|
||||||
Values: v,
|
Values: val,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning outputs a warning log with given format and optional arguments.
|
// Warning outputs a warning log with given format and optional arguments.
|
||||||
func Warning(v ...interface{}) {
|
func Warning(val ...interface{}) {
|
||||||
warningLogger.Log(&internal.ErrorLog{
|
warningLogger.Log(&internal.ErrorLog{
|
||||||
Prefix: "[Warning]",
|
Prefix: "[Warning]",
|
||||||
Values: v,
|
Values: val,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error outputs an error log with given format and optional arguments.
|
// Error outputs an error log with given format and optional arguments.
|
||||||
func Error(v ...interface{}) {
|
func Error(val ...interface{}) {
|
||||||
errorLogger.Log(&internal.ErrorLog{
|
errorLogger.Log(&internal.ErrorLog{
|
||||||
Prefix: "[Error]",
|
Prefix: "[Error]",
|
||||||
Values: v,
|
Values: val,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,21 +23,21 @@ func PortFromBytes(port []byte) Port {
|
||||||
|
|
||||||
// PortFromInt converts an integer to a Port.
|
// PortFromInt converts an integer to a Port.
|
||||||
// @error when the integer is not positive or larger then 65535
|
// @error when the integer is not positive or larger then 65535
|
||||||
func PortFromInt(v uint32) (Port, error) {
|
func PortFromInt(val uint32) (Port, error) {
|
||||||
if v > 65535 {
|
if val > 65535 {
|
||||||
return Port(0), ErrInvalidPortRange
|
return Port(0), ErrInvalidPortRange
|
||||||
}
|
}
|
||||||
return Port(v), nil
|
return Port(val), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PortFromString converts a string to a Port.
|
// PortFromString converts a string to a Port.
|
||||||
// @error when the string is not an integer or the integral value is a not a valid Port.
|
// @error when the string is not an integer or the integral value is a not a valid Port.
|
||||||
func PortFromString(s string) (Port, error) {
|
func PortFromString(s string) (Port, error) {
|
||||||
v, err := strconv.ParseUint(s, 10, 32)
|
val, err := strconv.ParseUint(s, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Port(0), ErrInvalidPortRange
|
return Port(0), ErrInvalidPortRange
|
||||||
}
|
}
|
||||||
return PortFromInt(uint32(v))
|
return PortFromInt(uint32(val))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Value return the correspoding uint16 value of this Port.
|
// Value return the correspoding uint16 value of this Port.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package predicate
|
package predicate
|
||||||
|
|
||||||
func BytesAll(array []byte, b byte) bool {
|
func BytesAll(array []byte, b byte) bool {
|
||||||
for _, v := range array {
|
for _, val := range array {
|
||||||
if v != b {
|
if val != b {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ func TestGenerateRandomInt64InRange(t *testing.T) {
|
||||||
generator := NewTimestampGenerator(Timestamp(base), delta)
|
generator := NewTimestampGenerator(Timestamp(base), delta)
|
||||||
|
|
||||||
for i := 0; i < 100; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
v := int64(generator())
|
val := int64(generator())
|
||||||
assert.Int64(v).AtMost(base + int64(delta))
|
assert.Int64(val).AtMost(base + int64(delta))
|
||||||
assert.Int64(v).AtLeast(base - int64(delta))
|
assert.Int64(val).AtLeast(base - int64(delta))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,15 +61,15 @@ func build(targetOS, targetArch string, archive bool, version string, metadataFi
|
||||||
v2rayArch := parseArch(targetArch)
|
v2rayArch := parseArch(targetArch)
|
||||||
|
|
||||||
if len(version) == 0 {
|
if len(version) == 0 {
|
||||||
v, err := git.RepoVersionHead()
|
headVer, err := git.RepoVersionHead()
|
||||||
if v == git.VersionUndefined {
|
if headVer == git.VersionUndefined {
|
||||||
v = "custom"
|
headVer = "custom"
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Unable to detect V2Ray version: " + err.Error())
|
fmt.Println("Unable to detect V2Ray version: " + err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
version = v
|
version = headVer
|
||||||
}
|
}
|
||||||
fmt.Printf("Building V2Ray (%s) for %s %s\n", version, v2rayOS, v2rayArch)
|
fmt.Printf("Building V2Ray (%s) for %s %s\n", version, v2rayOS, v2rayArch)
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ func (this *DnsConfig) Build() *dns.Config {
|
||||||
|
|
||||||
if this.Hosts != nil {
|
if this.Hosts != nil {
|
||||||
config.Hosts = make(map[string]*v2net.IPOrDomain)
|
config.Hosts = make(map[string]*v2net.IPOrDomain)
|
||||||
for k, v := range this.Hosts {
|
for domain, ip := range this.Hosts {
|
||||||
config.Hosts[k] = v.Build()
|
config.Hosts[domain] = ip.Build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,11 +81,11 @@ func main() {
|
||||||
|
|
||||||
func formatArray(a []byte) string {
|
func formatArray(a []byte) string {
|
||||||
r := "[]byte{"
|
r := "[]byte{"
|
||||||
for idx, v := range a {
|
for idx, val := range a {
|
||||||
if idx > 0 {
|
if idx > 0 {
|
||||||
r += ","
|
r += ","
|
||||||
}
|
}
|
||||||
r += fmt.Sprintf("%d", v)
|
r += fmt.Sprintf("%d", val)
|
||||||
}
|
}
|
||||||
r += "}"
|
r += "}"
|
||||||
return r
|
return r
|
||||||
|
|
|
@ -219,13 +219,13 @@ func (this *SendingWorker) ProcessReceivingNextWithoutLock(nextNumber uint32) {
|
||||||
|
|
||||||
// Private: Visible for testing.
|
// Private: Visible for testing.
|
||||||
func (this *SendingWorker) FindFirstUnacknowledged() {
|
func (this *SendingWorker) FindFirstUnacknowledged() {
|
||||||
v := this.firstUnacknowledged
|
first := this.firstUnacknowledged
|
||||||
if !this.window.IsEmpty() {
|
if !this.window.IsEmpty() {
|
||||||
this.firstUnacknowledged = this.window.FirstNumber()
|
this.firstUnacknowledged = this.window.FirstNumber()
|
||||||
} else {
|
} else {
|
||||||
this.firstUnacknowledged = this.nextNumber
|
this.firstUnacknowledged = this.nextNumber
|
||||||
}
|
}
|
||||||
if v != this.firstUnacknowledged {
|
if first != this.firstUnacknowledged {
|
||||||
this.firstUnacknowledgedUpdated = true
|
this.firstUnacknowledgedUpdated = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,11 @@ func TestHubSocksOption(t *testing.T) {
|
||||||
fd, err := internal.GetSysFd(conn)
|
fd, err := internal.GetSysFd(conn)
|
||||||
assert.Error(err).IsNil()
|
assert.Error(err).IsNil()
|
||||||
|
|
||||||
v, err := syscall.GetsockoptInt(fd, syscall.SOL_IP, syscall.IP_TRANSPARENT)
|
val, err := syscall.GetsockoptInt(fd, syscall.SOL_IP, syscall.IP_TRANSPARENT)
|
||||||
assert.Error(err).IsNil()
|
assert.Error(err).IsNil()
|
||||||
assert.Int(v).Equals(1)
|
assert.Int(val).Equals(1)
|
||||||
|
|
||||||
v, err = syscall.GetsockoptInt(fd, syscall.SOL_IP, syscall.IP_RECVORIGDSTADDR)
|
val, err = syscall.GetsockoptInt(fd, syscall.SOL_IP, syscall.IP_RECVORIGDSTADDR)
|
||||||
assert.Error(err).IsNil()
|
assert.Error(err).IsNil()
|
||||||
assert.Int(v).Equals(1)
|
assert.Int(val).Equals(1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,9 +71,9 @@ func (this *ConnectionCache) Recycle(dest string, conn *wsconn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var list []*AwaitingConnection
|
var list []*AwaitingConnection
|
||||||
if v, found := this.cache[dest]; found {
|
if val, found := this.cache[dest]; found {
|
||||||
v = append(v, aconn)
|
val = append(val, aconn)
|
||||||
list = v
|
list = val
|
||||||
} else {
|
} else {
|
||||||
list = []*AwaitingConnection{aconn}
|
list = []*AwaitingConnection{aconn}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue