本文整理汇总了Golang中github.com/v2ray/v2ray-core/common/net.Port.Value方法的典型用法代码示例。如果您正苦于以下问题:Golang Port.Value方法的具体用法?Golang Port.Value怎么用?Golang Port.Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/v2ray/v2ray-core/common/net.Port
的用法示例。
在下文中一共展示了Port.Value方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewSocks4AuthenticationResponse
func NewSocks4AuthenticationResponse(result byte, port v2net.Port, ip []byte) *Socks4AuthenticationResponse {
return &Socks4AuthenticationResponse{
result: result,
port: port.Value(),
ip: ip,
}
}
示例2: Listen
func (this *HttpProxyServer) Listen(port v2net.Port) error {
tcpListener, err := net.ListenTCP("tcp", &net.TCPAddr{
Port: int(port.Value()),
IP: []byte{0, 0, 0, 0},
})
if err != nil {
return err
}
go this.accept(tcpListener)
return nil
}
示例3: Listen
func (this *HttpProxyServer) Listen(port v2net.Port) error {
tcpListener, err := net.ListenTCP("tcp", &net.TCPAddr{
Port: int(port.Value()),
IP: []byte{0, 0, 0, 0},
})
if err != nil {
return err
}
this.Lock()
this.tcpListener = tcpListener
this.Unlock()
this.accepting = true
go this.accept()
return nil
}
示例4: Listen
func (this *HttpProxyServer) Listen(port v2net.Port) error {
if this.accepting {
if this.listeningPort == port {
return nil
} else {
return proxy.ErrorAlreadyListening
}
}
this.listeningPort = port
tcpListener, err := net.ListenTCP("tcp", &net.TCPAddr{
Port: int(port.Value()),
IP: []byte{0, 0, 0, 0},
})
if err != nil {
return err
}
this.Lock()
this.tcpListener = tcpListener
this.Unlock()
this.accepting = true
go this.accept()
return nil
}
示例5: LessThan
func (subject *PortSubject) LessThan(expectation v2net.Port) {
if subject.value.Value() >= expectation.Value() {
subject.Fail(subject.DisplayString(), "is less than", expectation)
}
}
示例6: GreaterThan
func (subject *PortSubject) GreaterThan(expectation v2net.Port) {
if subject.value.Value() <= expectation.Value() {
subject.Fail(subject.DisplayString(), "is greater than", expectation)
}
}
示例7: Equals
func (subject *PortSubject) Equals(expectation v2net.Port) {
if subject.value.Value() != expectation.Value() {
subject.Fail(subject.DisplayString(), "is equal to", expectation)
}
}