本文整理匯總了Golang中github.com/v2ray/v2ray-core/common/net.Port類的典型用法代碼示例。如果您正苦於以下問題:Golang Port類的具體用法?Golang Port怎麽用?Golang Port使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Port類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewSocks4AuthenticationResponse
func NewSocks4AuthenticationResponse(result byte, port v2net.Port, ip []byte) *Socks4AuthenticationResponse {
return &Socks4AuthenticationResponse{
result: result,
port: port.Value(),
ip: ip,
}
}
示例2: Port
func (this *Assert) Port(value v2net.Port) *PortSubject {
return &PortSubject{
Subject: Subject{
a: this,
disp: value.String(),
},
value: value,
}
}
示例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
}
go this.accept(tcpListener)
return nil
}
示例4: 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
}
示例5: 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
}
示例6: LessThan
func (subject *PortSubject) LessThan(expectation v2net.Port) {
if subject.value.Value() >= expectation.Value() {
subject.Fail(subject.DisplayString(), "is less than", expectation)
}
}
示例7: GreaterThan
func (subject *PortSubject) GreaterThan(expectation v2net.Port) {
if subject.value.Value() <= expectation.Value() {
subject.Fail(subject.DisplayString(), "is greater than", expectation)
}
}
示例8: Equals
func (subject *PortSubject) Equals(expectation v2net.Port) {
if subject.value.Value() != expectation.Value() {
subject.Fail(subject.DisplayString(), "is equal to", expectation)
}
}