Skip to content

Commit

Permalink
Put the library version in a central place (tunnelproxy/_version.py)
Browse files Browse the repository at this point in the history
  • Loading branch information
De117 committed Feb 23, 2023
1 parent 9baf175 commit c52b40e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions tunnelproxy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A small, whitelisting HTTP CONNECT proxy.
"""
from ._version import __version__

from ._proxy import (
TunnelProxy,
Expand Down
3 changes: 2 additions & 1 deletion tunnelproxy/_adapter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import trio, h11, json, random
from wsgiref.handlers import format_date_time
from typing import List, Tuple, Optional, Union, Type
from . import __version__

################################################################
# I/O adapter: h11 <-> trio
Expand All @@ -24,7 +25,7 @@ def __init__(self, stream: trio.abc.HalfCloseableStream, shutdown_timeout: float
"""
self.stream = stream
self.conn = h11.Connection(h11.SERVER)
self.server_header = f"tunnelproxy/1.0 ({h11.PRODUCT_ID})".encode()
self.server_header = f"tunnelproxy/{__version__} ({h11.PRODUCT_ID})".encode()
self._connection_id = hex(random.getrandbits(64))[2:].zfill(16)
self.shutdown_timeout = shutdown_timeout

Expand Down
2 changes: 2 additions & 0 deletions tunnelproxy/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file is read by both __init__.py and setup.py
__version__ = "0.1.0"

0 comments on commit c52b40e

Please sign in to comment.