MCPcopy Index your code
hub / github.com/cameri/nostream / getTorClient

Function getTorClient

src/tor/client.ts:159–177  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157let client: TorClient | undefined
158
159export const getTorClient = async () => {
160 if (!client) {
161 const config = createTorConfig()
162 logger('config: %o', config)
163
164 if (config.host !== undefined) {
165 logger('connecting')
166 client = new TorClient(config)
167 try {
168 await client.connect()
169 } catch (_error) {
170 client = undefined
171 }
172 logger('connected')
173 }
174 }
175
176 return client
177}
178export const closeTorClient = async () => {
179 if (client) {
180 await client.quit()

Callers 2

onion.spec.tsFile · 0.90
addOnionFunction · 0.85

Calls 2

createTorConfigFunction · 0.85
connectMethod · 0.80

Tested by

no test coverage detected