Git - gTunnel
gtunnel:
/ testconfig.py
[ Download ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 | #!/usr/bin/env python
import os
import logging
logging.basicConfig(
level = logging.DEBUG,
format = '%(levelname)-8s %(message)s'
)
import shelve
import gtunnel.uuid as uuid
# Open config file
configdir = os.path.join(os.environ['HOME'], '.gtunnel')
configpath = os.path.join(configdir, 'connections.cfg')
if not os.path.exists(configdir):
logging.info("Creating configuration directory %s" % configdir)
os.mkdir(configdir)
logging.info("Deleting connections file %s" % configpath)
try:
os.remove(configpath)
except:
pass
logging.info("Using connections file %s" % configpath)
config = shelve.open(configpath)
config[str(uuid.uuid4())] = dict({
'name': 'Unnamed',
'host': '127.0.0.1',
'user': 'root',
'port': 22,
'autoconnect': False,
'tunnels': dict({
str(uuid.uuid4()): {
'port_src': 1234,
'port_dest': 1234,
'host_dest': 'localhost',
},
}),
})
|