[bugfix] fix proxy hen host ip using domain name (#4243)
### What this PR does / why we need it?
fix proxy when host ip using domain name
- vLLM version: v0.11.0
- vLLM main:
2918c1b49c
---------
Signed-off-by: liziyu <liziyu16@huawei.com>
This commit is contained in:
@@ -116,13 +116,13 @@ class ServerState:
|
|||||||
def __init__(self, host, port):
|
def __init__(self, host, port):
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
ip = ipaddress.ip_address(self.host)
|
self.url = f'http://{host}:{port}/v1'
|
||||||
if isinstance(ip, ipaddress.IPv4Address):
|
try:
|
||||||
self.url = f'http://{host}:{port}/v1'
|
ip = ipaddress.ip_address(self.host)
|
||||||
elif isinstance(ip, ipaddress.IPv6Address):
|
if isinstance(ip, ipaddress.IPv6Address):
|
||||||
self.url = f'http://[{host}]:{port}/v1'
|
self.url = f'http://[{host}]:{port}/v1'
|
||||||
else:
|
except Exception:
|
||||||
raise RuntimeError(f"Invild host IP address {ip}")
|
pass
|
||||||
self.client = httpx.AsyncClient(timeout=None,
|
self.client = httpx.AsyncClient(timeout=None,
|
||||||
base_url=self.url,
|
base_url=self.url,
|
||||||
limits=httpx.Limits(
|
limits=httpx.Limits(
|
||||||
|
|||||||
@@ -118,13 +118,13 @@ class ServerState:
|
|||||||
def __init__(self, host, port):
|
def __init__(self, host, port):
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
ip = ipaddress.ip_address(self.host)
|
self.url = f'http://{host}:{port}/v1'
|
||||||
if isinstance(ip, ipaddress.IPv4Address):
|
try:
|
||||||
self.url = f'http://{host}:{port}/v1'
|
ip = ipaddress.ip_address(self.host)
|
||||||
elif isinstance(ip, ipaddress.IPv6Address):
|
if isinstance(ip, ipaddress.IPv6Address):
|
||||||
self.url = f'http://[{host}]:{port}/v1'
|
self.url = f'http://[{host}]:{port}/v1'
|
||||||
else:
|
except Exception:
|
||||||
raise RuntimeError(f"Invild host IP address {ip}")
|
pass
|
||||||
self.client = httpx.AsyncClient(timeout=None,
|
self.client = httpx.AsyncClient(timeout=None,
|
||||||
base_url=self.url,
|
base_url=self.url,
|
||||||
limits=httpx.Limits(
|
limits=httpx.Limits(
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ def get_global_te(hostname: str, device_name: Optional[str]):
|
|||||||
ip = ipaddress.ip_address(hostname)
|
ip = ipaddress.ip_address(hostname)
|
||||||
if isinstance(ip, ipaddress.IPv6Address):
|
if isinstance(ip, ipaddress.IPv6Address):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"The backend if mooncake's Ascend Direct Xfer Library currcenly dose not support IPv6."
|
"The backend of mooncake's Ascend Direct Xfer Library currently does not support IPv6."
|
||||||
)
|
)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user