MCPcopy Create free account
hub / github.com/apenwarr/sshuttle / _connect

Method _connect

ui-macos/main.py:152–183  ·  view source on GitHub ↗
(self, server)

Source from the content-addressed store, hash-verified

150 conns = {}
151
152 def _connect(self, server):
153 host = server.host()
154 print 'connecting %r' % host
155 self.fill_menu()
156 def logfunc(msg):
157 print 'log! (%d bytes)' % len(msg)
158 self.logField.textStorage()\
159 .appendAttributedString_(NSAttributedString.alloc()\
160 .initWithString_(msg))
161 self.logField.didChangeText()
162 def promptfunc(prompt):
163 print 'prompt! %r' % prompt
164 return askpass.askpass(prompt)
165 nets_mode = server.autoNets()
166 if nets_mode == models.NET_MANUAL:
167 manual_nets = ["%s/%d" % (i.subnet(), i.width())
168 for i in server.nets()]
169 elif nets_mode == models.NET_ALL:
170 manual_nets = ['0/0']
171 else:
172 manual_nets = []
173 noLatencyControl = (server.latencyControl() != models.LAT_INTERACTIVE)
174 conn = Runner(sshuttle_args(host,
175 auto_nets = nets_mode == models.NET_AUTO,
176 auto_hosts = server.autoHosts(),
177 dns = server.useDns(),
178 nets = manual_nets,
179 debug = self.debugField.state(),
180 no_latency_control = noLatencyControl),
181 logfunc=logfunc, promptfunc=promptfunc,
182 serverobj=server)
183 self.conns[host] = conn
184
185 def _disconnect(self, server):
186 host = server.host()

Callers 1

scMethod · 0.95

Calls 11

fill_menuMethod · 0.95
RunnerClass · 0.85
sshuttle_argsFunction · 0.85
hostMethod · 0.80
autoNetsMethod · 0.80
subnetMethod · 0.80
widthMethod · 0.80
netsMethod · 0.80
latencyControlMethod · 0.80
autoHostsMethod · 0.80
useDnsMethod · 0.80

Tested by

no test coverage detected