Created
April 12, 2024 18:17
-
-
Save mbenachour/24da7e6c35a1a9e07cb2b0ec4c6ef66a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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