Skip to content

Instantly share code, notes, and snippets.

@mbenachour
Created April 12, 2024 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbenachour/24da7e6c35a1a9e07cb2b0ec4c6ef66a to your computer and use it in GitHub Desktop.
Save mbenachour/24da7e6c35a1a9e07cb2b0ec4c6ef66a to your computer and use it in GitHub Desktop.
#!python3
import sys
import zrok
from zrok.model import ShareRequest
import atexit
zrok_opts = {}
root = zrok.environment.root.Load()
try:
shr = zrok.share.CreateShare(root=root, request=ShareRequest(
BackendMode=zrok.model.TCP_TUNNEL_BACKEND_MODE,
ShareMode=zrok.model.PUBLIC_SHARE_MODE,
Frontends=['public'],
Target="http://localhost:8000"
))
shrToken = shr.Token
print("Access server at the following endpoints: ", "\n".join(shr.FrontendEndpoints))
except Exception as e:
print("unable to create share", e)
sys.exit(1)
input("Press enter to continue...")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment