예제 #1
0
파일: wsgi.py 프로젝트: plq/spyne
    def get_peer(self):
        addr, port = address_parser.get_ip(self.req),\
                                               address_parser.get_port(self.req)

        if address_parser.is_valid_ipv4(addr):
            return Address(type=Address.TCP4, host=addr, port=port)

        if address_parser.is_valid_ipv6(addr):
            return Address(type=Address.TCP6, host=addr, port=port)
예제 #2
0
파일: wsgi.py 프로젝트: cdcanasg/spyne
    def get_peer(self):
        addr, port = address_parser.get_ip(self.req),\
                                               address_parser.get_port(self.req)

        if address_parser.is_valid_ipv4(addr):
            return Address(type=Address.TCP4, host=addr, port=port)

        if address_parser.is_valid_ipv6(addr):
            return Address(type=Address.TCP6, host=addr, port=port)
예제 #3
0
파일: http.py 프로젝트: dsf459133415/spyne
    def get_peer(self):
        peer = Address.from_twisted_address(self.req.transport.getPeer())
        addr = address_parser.get_ip(_Transformer(self.req))

        if addr is None:
            return peer

        if address_parser.is_valid_ipv4(addr):
            return Address(type=Address.TCP4, host=addr, port=0)

        if address_parser.is_valid_ipv6(addr):
            return Address(type=Address.TCP6, host=addr, port=0)
예제 #4
0
파일: http.py 프로젝트: knoxsp/spyne
    def get_peer(self):
        peer = Address.from_twisted_address(self.req.transport.getPeer())
        addr = address_parser.get_ip(_Transformer(self.req))

        if addr is None:
            return peer

        if address_parser.is_valid_ipv4(addr):
            return Address(type=Address.TCP4, host=addr, port=0)

        if address_parser.is_valid_ipv6(addr):
            return Address(type=Address.TCP6, host=addr, port=0)
예제 #5
0
    def get_peer(self) -> typing.Optional[Address]:
        if not self.req_env.transport:
            return None

        peer = self.req_env.transport.get_extra_info("peername")
        if not peer:
            return None
        host, port = peer

        if address_parser.is_valid_ipv4(host):
            return Address(type=Address.TCP4, host=host, port=port)

        if address_parser.is_valid_ipv6(host):
            return Address(type=Address.TCP6, host=host, port=port)

        return None