Forward internet through access point to clients. #18580
Replies: 2 comments 2 replies
-
|
No, If you only want to expose a single port in an Application proxy style you could do this using asyncio, #untested snippet follows import uasyncio as asyncio
async def pipe(reader, writer):
try:
while True:
data = await reader.read(1024)
if not data:
break
writer.write(data)
await writer.drain()
finally:
try:
await writer.aclose()
except:
pass
async def forward(local_host, local_port, remote_host, remote_port):
async def handler(r, w):
rr, rw = await asyncio.open_connection(remote_host, remote_port)
await asyncio.gather(pipe(r, rw), pipe(rr, w))
return await asyncio.start_server(handler, local_host, local_port)
async def main():
# Listen on ESP32:8080 and forward to 192.168.1.50:80
await forward("0.0.0.0", 8080, "192.168.1.50", 80)
while True:
await asyncio.sleep(3600)
asyncio.run(main()) |
Beta Was this translation helpful? Give feedback.
-
|
Well, it's not completely hopeless. I have custom-built firmware that provides NAT routing from the access point (AP) to the station (STA). Then, I connect my phone to the access point (AP) and gain network access with an IP address of "10.10.6.2". I can play YouTube videos in 1080p quality through the ESP32 without any problems. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to forward internet from a connected WIFI network through an access point.
like if I connect to my homes router then start an access point from my esp32 would I be able to give the clients that connect to the access point internet from the routers WIFI?
I'm using the network library btw but if you have any libraries that might work for this let me know.
Beta Was this translation helpful? Give feedback.
All reactions