mirror of
https://github.com/openziti/zrok.git
synced 2026-08-28 18:34:12 -05:00
2.3 KiB
2.3 KiB
In [ ]:
! pip install zrokIn [ ]:
import zrok
from zrok.proxy import ProxyShare
In [ ]:
target_url = "http://127.0.0.1:8000/"
unique_name = "myuniquename" # a name to reuse each run or 'None' for random
share_mode = "public" # "public" or "private"
frontend = "public" # custom domain frontend or "public"
if unique_name.lower() == "none":
unique_name = None
In [ ]:
zrok_env = zrok.environment.root.Load() # Load the environment from ~/.zrok
proxy_share = ProxyShare.create(
root=zrok_env,
target=target_url,
frontends=[frontend],
share_mode=share_mode,
unique_name=unique_name,
verify_ssl=True # Set 'False' to skip SSL verification
)
In [ ]:
if share_mode == "public":
print(f"Access proxy at: {', '.join(proxy_share.endpoints)}")
elif share_mode == "private":
print(f"Run a private access frontend: 'zrok access private {proxy_share.token}'")
proxy_share.run()