Browse Source

minor docs, use functools.wraps

main
John-Mark Gurney 1 year ago
parent
commit
a1c7447613
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      ntunnel/__init__.py

+ 6
- 2
ntunnel/__init__.py View File

@@ -38,6 +38,7 @@ from noise.connection import NoiseConnection, Keypair
import argparse import argparse
import asyncio import asyncio
import base64 import base64
import functools
import os.path import os.path
import shutil import shutil
import socket import socket
@@ -250,7 +251,9 @@ def parsesockstr(sockstr):
return proto, args return proto, args


async def connectsockstr(sockstr): async def connectsockstr(sockstr):
'''Wrapper for asyncio.open_*_connection.'''
'''Wrapper for asyncio.open_*_connection.

For the format of sockstr, please see parsesockstr.'''


proto, args = parsesockstr(sockstr) proto, args = parsesockstr(sockstr)


@@ -264,7 +267,7 @@ async def connectsockstr(sockstr):
return reader, writer return reader, writer


async def listensockstr(sockstr, cb): async def listensockstr(sockstr, cb):
'''Wrapper for asyncio.start_x_server.
'''Wrapper for asyncio.start_*_server.


For the format of sockstr, please see parsesockstr. For the format of sockstr, please see parsesockstr.


@@ -505,6 +508,7 @@ async def NoiseForwarder(mode, encrdrwrr, connvalid, priv_key, pub_key=None):
# Slightly modified to timeout and to print trace back when canceled. # Slightly modified to timeout and to print trace back when canceled.
# This makes it easier to figure out what "froze". # This makes it easier to figure out what "froze".
def async_test(f): def async_test(f):
@functools.wraps(f)
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
async def tbcapture(): async def tbcapture():
try: try:


Loading…
Cancel
Save