コード例 #1
0
ファイル: socks4.go プロジェクト: ChoyesYan/v2ray-core
func NewSocks4AuthenticationResponse(result byte, port v2net.Port, ip []byte) *Socks4AuthenticationResponse {
	return &Socks4AuthenticationResponse{
		result: result,
		port:   port.Value(),
		ip:     ip,
	}
}
コード例 #2
0
ファイル: http.go プロジェクト: adoot/v2ray-core
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
0
ファイル: http.go プロジェクト: ibmendoza/v2ray-core
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
0
ファイル: http.go プロジェクト: jun0205/v2ray-core
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
0
ファイル: port.go プロジェクト: ducktsmt/v2ray-core
func (subject *PortSubject) LessThan(expectation v2net.Port) {
	if subject.value.Value() >= expectation.Value() {
		subject.Fail(subject.DisplayString(), "is less than", expectation)
	}
}
コード例 #6
0
ファイル: port.go プロジェクト: ducktsmt/v2ray-core
func (subject *PortSubject) GreaterThan(expectation v2net.Port) {
	if subject.value.Value() <= expectation.Value() {
		subject.Fail(subject.DisplayString(), "is greater than", expectation)
	}
}
コード例 #7
0
ファイル: port.go プロジェクト: ducktsmt/v2ray-core
func (subject *PortSubject) Equals(expectation v2net.Port) {
	if subject.value.Value() != expectation.Value() {
		subject.Fail(subject.DisplayString(), "is equal to", expectation)
	}
}