1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-10 18:00:43 +00:00

remove use of 'v' as a variable name

This commit is contained in:
Darien Raymond 2016-11-27 17:01:44 +01:00
parent 77e1427845
commit d00f8eef56
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
12 changed files with 45 additions and 45 deletions

View File

@ -6,9 +6,9 @@ import (
"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)
for domain, ipOrDomain := range this.GetHosts() {
for domain, ipOrDomain := range v.GetHosts() {
address := ipOrDomain.AsAddress()
if address.Family().IsDomain() {
log.Warning("DNS: Ignoring domain address in static hosts: ", address.Domain())

View File

@ -77,13 +77,13 @@ func (b *Buffer) AppendString(s string) *Buffer {
return b
}
func (b *Buffer) AppendUint16(v uint16) *Buffer {
b.Value = serial.Uint16ToBytes(v, b.Value)
func (b *Buffer) AppendUint16(val uint16) *Buffer {
b.Value = serial.Uint16ToBytes(val, b.Value)
return b
}
func (b *Buffer) AppendUint32(v uint32) *Buffer {
b.Value = serial.Uint32ToBytes(v, b.Value)
func (b *Buffer) AppendUint32(val uint32) *Buffer {
b.Value = serial.Uint32ToBytes(val, b.Value)
return b
}
@ -99,15 +99,15 @@ func (b *Buffer) PrependBytes(data ...byte) *Buffer {
return b.Prepend(data)
}
func (b *Buffer) PrependUint16(v uint16) *Buffer {
func (b *Buffer) PrependUint16(val uint16) *Buffer {
b.SliceBack(2)
serial.Uint16ToBytes(v, b.Value[:0])
serial.Uint16ToBytes(val, b.Value[:0])
return b
}
func (b *Buffer) PrependUint32(v uint32) *Buffer {
func (b *Buffer) PrependUint32(val uint32) *Buffer {
b.SliceBack(4)
serial.Uint32ToBytes(v, b.Value[:0])
serial.Uint32ToBytes(val, b.Value[:0])
return b
}

View File

@ -46,34 +46,34 @@ func InitErrorLogger(file string) error {
}
// Debug outputs a debug log with given format and optional arguments.
func Debug(v ...interface{}) {
func Debug(val ...interface{}) {
debugLogger.Log(&internal.ErrorLog{
Prefix: "[Debug]",
Values: v,
Values: val,
})
}
// Info outputs an info log with given format and optional arguments.
func Info(v ...interface{}) {
func Info(val ...interface{}) {
infoLogger.Log(&internal.ErrorLog{
Prefix: "[Info]",
Values: v,
Values: val,
})
}
// Warning outputs a warning log with given format and optional arguments.
func Warning(v ...interface{}) {
func Warning(val ...interface{}) {
warningLogger.Log(&internal.ErrorLog{
Prefix: "[Warning]",
Values: v,
Values: val,
})
}
// Error outputs an error log with given format and optional arguments.
func Error(v ...interface{}) {
func Error(val ...interface{}) {
errorLogger.Log(&internal.ErrorLog{
Prefix: "[Error]",
Values: v,
Values: val,
})
}

View File

@ -23,21 +23,21 @@ func PortFromBytes(port []byte) Port {
// PortFromInt converts an integer to a Port.
// @error when the integer is not positive or larger then 65535
func PortFromInt(v uint32) (Port, error) {
if v > 65535 {
func PortFromInt(val uint32) (Port, error) {
if val > 65535 {
return Port(0), ErrInvalidPortRange
}
return Port(v), nil
return Port(val), nil
}
// 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.
func PortFromString(s string) (Port, error) {
v, err := strconv.ParseUint(s, 10, 32)
val, err := strconv.ParseUint(s, 10, 32)
if err != nil {
return Port(0), ErrInvalidPortRange
}
return PortFromInt(uint32(v))
return PortFromInt(uint32(val))
}
// Value return the correspoding uint16 value of this Port.

View File

@ -1,8 +1,8 @@
package predicate
func BytesAll(array []byte, b byte) bool {
for _, v := range array {
if v != b {
for _, val := range array {
if val != b {
return false
}
}

View File

@ -16,8 +16,8 @@ func TestGenerateRandomInt64InRange(t *testing.T) {
generator := NewTimestampGenerator(Timestamp(base), delta)
for i := 0; i < 100; i++ {
v := int64(generator())
assert.Int64(v).AtMost(base + int64(delta))
assert.Int64(v).AtLeast(base - int64(delta))
val := int64(generator())
assert.Int64(val).AtMost(base + int64(delta))
assert.Int64(val).AtLeast(base - int64(delta))
}
}

View File

@ -61,15 +61,15 @@ func build(targetOS, targetArch string, archive bool, version string, metadataFi
v2rayArch := parseArch(targetArch)
if len(version) == 0 {
v, err := git.RepoVersionHead()
if v == git.VersionUndefined {
v = "custom"
headVer, err := git.RepoVersionHead()
if headVer == git.VersionUndefined {
headVer = "custom"
}
if err != nil {
fmt.Println("Unable to detect V2Ray version: " + err.Error())
return
}
version = v
version = headVer
}
fmt.Printf("Building V2Ray (%s) for %s %s\n", version, v2rayOS, v2rayArch)

View File

@ -23,8 +23,8 @@ func (this *DnsConfig) Build() *dns.Config {
if this.Hosts != nil {
config.Hosts = make(map[string]*v2net.IPOrDomain)
for k, v := range this.Hosts {
config.Hosts[k] = v.Build()
for domain, ip := range this.Hosts {
config.Hosts[domain] = ip.Build()
}
}

View File

@ -81,11 +81,11 @@ func main() {
func formatArray(a []byte) string {
r := "[]byte{"
for idx, v := range a {
for idx, val := range a {
if idx > 0 {
r += ","
}
r += fmt.Sprintf("%d", v)
r += fmt.Sprintf("%d", val)
}
r += "}"
return r

View File

@ -219,13 +219,13 @@ func (this *SendingWorker) ProcessReceivingNextWithoutLock(nextNumber uint32) {
// Private: Visible for testing.
func (this *SendingWorker) FindFirstUnacknowledged() {
v := this.firstUnacknowledged
first := this.firstUnacknowledged
if !this.window.IsEmpty() {
this.firstUnacknowledged = this.window.FirstNumber()
} else {
this.firstUnacknowledged = this.nextNumber
}
if v != this.firstUnacknowledged {
if first != this.firstUnacknowledged {
this.firstUnacknowledgedUpdated = true
}
}

View File

@ -32,11 +32,11 @@ func TestHubSocksOption(t *testing.T) {
fd, err := internal.GetSysFd(conn)
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.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.Int(v).Equals(1)
assert.Int(val).Equals(1)
}

View File

@ -71,9 +71,9 @@ func (this *ConnectionCache) Recycle(dest string, conn *wsconn) {
}
var list []*AwaitingConnection
if v, found := this.cache[dest]; found {
v = append(v, aconn)
list = v
if val, found := this.cache[dest]; found {
val = append(val, aconn)
list = val
} else {
list = []*AwaitingConnection{aconn}
}