-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDOCS.html
811 lines (807 loc) · 19.6 KB
/
DOCS.html
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
<html>
<head>
<title>
onramp
</title>
<meta name="author" content="eyedeekay" />
<meta name="description" content="onramp.git" />
<meta name="keywords" content="main" />
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="showhider.css" />
</head>
<body>
<div id="navbar">
<a href="#shownav">
Show navigation
</a>
<div id="shownav">
<div id="hidenav">
<ul>
<li>
<a href="..">
Up one level ^
</a>
</li>
<li>
<a href="index.html">
index
</a>
</li>
<li>
<a href="DESC.html">
DESC
</a>
</li>
<li>
<a href="DOCS.html">
DOCS
</a>
</li>
<li>
<a href="EXAMPLE.html">
EXAMPLE
</a>
</li>
</ul>
<br>
<a href="#hidenav">
Hide Navigation
</a>
</div>
</div>
</div>
<h1>
<a href="#onramp-i2p-and-tor-library" rel="nofollow">
<span></span>
</a>
Onramp I2P and Tor Library
</h1>
<p>
<a href="http://pkg.go.dev/." rel="nofollow">
<img src="https://img.shields.io/badge/pkg.go.dev-doc-blue" alt="GoDoc">
</a>
<a href="https://goreportcard.com/report/." rel="nofollow">
<img src="https://goreportcard.com/badge/." alt="Go Report Card">
</a>
</p>
<h2>
<a href="#variables" rel="nofollow">
<span></span>
</a>
Variables
</h2>
<p>
I2P_KEYSTORE_PATH is the place where I2P Keys will be saved.
it defaults to the directory "i2pkeys" current working directory
reference it by calling I2PKeystorePath() to check for errors
</p>
<div>
<pre>var I2P_KEYSTORE_PATH = i2pdefault
</pre>
</div>
<p>
ONION_KEYSTORE_PATH is the place where Onion Keys will be saved.
it defaults to the directory "onionkeys" current working directory
reference it by calling OnionKeystorePath() to check for errors
</p>
<div>
<pre>var ONION_KEYSTORE_PATH = tordefault
</pre>
</div>
<div>
<pre>var OPT_DEFAULTS = sam3.Options_Default
</pre>
</div>
<p>
SAM_ADDR is the default I2P SAM address. It can be overridden by the
struct or by changing this variable.
</p>
<div>
<pre>var SAM_ADDR = "127.0.0.1:7656"
</pre>
</div>
<h2>
<a href="#functions" rel="nofollow">
<span></span>
</a>
Functions
</h2>
<h3>
<a href="#func-closeallgarlic" rel="nofollow">
<span></span>
</a>
func
<a href="/garlic.go#L211" rel="nofollow">
CloseAllGarlic
</a>
</h3>
<p>
<code>
func CloseAllGarlic()
</code>
</p>
<p>
CloseAllGarlic closes all garlics managed by the onramp package. It does not
affect objects instantiated by an app.
</p>
<h3>
<a href="#func-closeallonion" rel="nofollow">
<span></span>
</a>
func
<a href="/onion.go#L174" rel="nofollow">
CloseAllOnion
</a>
</h3>
<p>
<code>
func CloseAllOnion()
</code>
</p>
<p>
CloseAllOnion closes all onions managed by the onramp package. It does not
affect objects instantiated by an app.
</p>
<h3>
<a href="#func-closegarlic" rel="nofollow">
<span></span>
</a>
func
<a href="/garlic.go#L220" rel="nofollow">
CloseGarlic
</a>
</h3>
<p>
<code>
func CloseGarlic(tunName string)
</code>
</p>
<p>
CloseGarlic closes the Garlic at the given index. It does not affect Garlic
objects instantiated by an app.
</p>
<h3>
<a href="#func-closeonion" rel="nofollow">
<span></span>
</a>
func
<a href="/onion.go#L183" rel="nofollow">
CloseOnion
</a>
</h3>
<p>
<code>
func CloseOnion(tunName string)
</code>
</p>
<p>
CloseOnion closes the Onion at the given index. It does not affect Onion
objects instantiated by an app.
</p>
<h3>
<a href="#func-createtlscertificate" rel="nofollow">
<span></span>
</a>
func
<a href="/tls.go#L20" rel="nofollow">
CreateTLSCertificate
</a>
</h3>
<p>
<code>
func CreateTLSCertificate(tlsHost string, tlsCert, tlsKey *string) error
</code>
</p>
<h3>
<a href="#func-deletegarlickeys" rel="nofollow">
<span></span>
</a>
func
<a href="/garlic.go#L159" rel="nofollow">
DeleteGarlicKeys
</a>
</h3>
<p>
<code>
func DeleteGarlicKeys(tunName string) error
</code>
</p>
<p>
DeleteGarlicKeys deletes the key file at the given path as determined by
keystore + tunName.
This is permanent and irreversible, and will change the onion service
address.
</p>
<h3>
<a href="#func-deletei2pkeystore" rel="nofollow">
<span></span>
</a>
func
<a href="/common.go#L60" rel="nofollow">
DeleteI2PKeyStore
</a>
</h3>
<p>
<code>
func DeleteI2PKeyStore() error
</code>
</p>
<p>
DeleteI2PKeyStore deletes the I2P Keystore.
</p>
<h3>
<a href="#func-deleteonionkeys" rel="nofollow">
<span></span>
</a>
func
<a href="/onion.go#L216" rel="nofollow">
DeleteOnionKeys
</a>
</h3>
<p>
<code>
func DeleteOnionKeys(tunName string) error
</code>
</p>
<p>
DeleteOnionKeys deletes the key file at the given path as determined by
keystore + tunName.
</p>
<h3>
<a href="#func-deletetorkeystore" rel="nofollow">
<span></span>
</a>
func
<a href="/common.go#L78" rel="nofollow">
DeleteTorKeyStore
</a>
</h3>
<p>
<code>
func DeleteTorKeyStore() error
</code>
</p>
<p>
DeleteTorKeyStore deletes the Onion Keystore.
</p>
<h3>
<a href="#func-dial" rel="nofollow">
<span></span>
</a>
func
<a href="/common.go#L85" rel="nofollow">
Dial
</a>
</h3>
<p>
<code>
func Dial(network, addr string) (net.Conn, error)
</code>
</p>
<p>
Dial returns a connection for the given network and address.
network is ignored. If the address ends in i2p, it returns an I2P connection.
if the address ends in anything else, it returns a Tor connection.
</p>
<h3>
<a href="#func-dialgarlic" rel="nofollow">
<span></span>
</a>
func
<a href="/garlic.go#L246" rel="nofollow">
DialGarlic
</a>
</h3>
<p>
<code>
func DialGarlic(network, addr string) (net.Conn, error)
</code>
</p>
<p>
DialGarlic returns a net.Conn for a garlic structure's keys
corresponding to a structure managed by the onramp library
and not instantiated by an app.
</p>
<h3>
<a href="#func-dialonion" rel="nofollow">
<span></span>
</a>
func
<a href="/onion.go#L205" rel="nofollow">
DialOnion
</a>
</h3>
<p>
<code>
func DialOnion(network, addr string) (net.Conn, error)
</code>
</p>
<p>
DialOnion returns a net.Conn for a onion structure's keys
corresponding to a structure managed by the onramp library
and not instantiated by an app.
</p>
<h3>
<a href="#func-getjoinedwd" rel="nofollow">
<span></span>
</a>
func
<a href="/common.go#L17" rel="nofollow">
GetJoinedWD
</a>
</h3>
<p>
<code>
func GetJoinedWD(dir string) (string, error)
</code>
</p>
<p>
GetJoinedWD returns the working directory joined with the given path.
</p>
<h3>
<a href="#func-i2pkeys" rel="nofollow">
<span></span>
</a>
func
<a href="/garlic.go#L173" rel="nofollow">
I2PKeys
</a>
</h3>
<p>
<code>
func I2PKeys(tunName, samAddr string) (i2pkeys.I2PKeys, error)
</code>
</p>
<p>
I2PKeys returns the I2PKeys at the keystore directory for the given
tunnel name. If none exist, they are created and stored.
</p>
<h3>
<a href="#func-i2pkeystorepath" rel="nofollow">
<span></span>
</a>
func
<a href="/common.go#L49" rel="nofollow">
I2PKeystorePath
</a>
</h3>
<p>
<code>
func I2PKeystorePath() (string, error)
</code>
</p>
<p>
I2PKeystorePath returns the path to the I2P Keystore. If the
path is not set, it returns the default path. If the path does
not exist, it creates it.
</p>
<h3>
<a href="#func-listen" rel="nofollow">
<span></span>
</a>
func
<a href="/common.go#L101" rel="nofollow">
Listen
</a>
</h3>
<p>
<code>
func Listen(network, keys string) (net.Listener, error)
</code>
</p>
<p>
Listen returns a listener for the given network and address.
if network is i2p or garlic, it returns an I2P listener.
if network is tor or onion, it returns an Onion listener.
if keys ends with ".i2p", it returns an I2P listener.
</p>
<h3>
<a href="#func-listengarlic" rel="nofollow">
<span></span>
</a>
func
<a href="/garlic.go#L234" rel="nofollow">
ListenGarlic
</a>
</h3>
<p>
<code>
func ListenGarlic(network, keys string) (net.Listener, error)
</code>
</p>
<p>
ListenGarlic returns a net.Listener for a garlic structure's keys
corresponding to a structure managed by the onramp library
and not instantiated by an app.
</p>
<h3>
<a href="#func-listenonion" rel="nofollow">
<span></span>
</a>
func
<a href="/onion.go#L193" rel="nofollow">
ListenOnion
</a>
</h3>
<p>
<code>
func ListenOnion(network, keys string) (net.Listener, error)
</code>
</p>
<p>
ListenOnion returns a net.Listener for a onion structure's keys
corresponding to a structure managed by the onramp library
and not instantiated by an app.
</p>
<h3>
<a href="#func-newtlscertificate" rel="nofollow">
<span></span>
</a>
func
<a href="/tls.go#L114" rel="nofollow">
NewTLSCertificate
</a>
</h3>
<p>
<code>
func NewTLSCertificate(host string, priv *ecdsa.PrivateKey) ([]byte, error)
</code>
</p>
<h3>
<a href="#func-newtlscertificatealtnames" rel="nofollow">
<span></span>
</a>
func
<a href="/tls.go#L118" rel="nofollow">
NewTLSCertificateAltNames
</a>
</h3>
<p>
<code>
func NewTLSCertificateAltNames(priv *ecdsa.PrivateKey, hosts ...string) ([]byte, error)
</code>
</p>
<h3>
<a href="#func-torkeys" rel="nofollow">
<span></span>
</a>
func
<a href="/onion.go#L135" rel="nofollow">
TorKeys
</a>
</h3>
<p>
<code>
func TorKeys(keyName string) (ed25519.KeyPair, error)
</code>
</p>
<p>
TorKeys returns a key pair which will be stored at the given key
name in the key store. If the key already exists, it will be
returned. If it does not exist, it will be generated.
</p>
<h3>
<a href="#func-torkeystorepath" rel="nofollow">
<span></span>
</a>
func
<a href="/common.go#L67" rel="nofollow">
TorKeystorePath
</a>
</h3>
<p>
<code>
func TorKeystorePath() (string, error)
</code>
</p>
<p>
TorKeystorePath returns the path to the Onion Keystore. If the
path is not set, it returns the default path. If the path does
not exist, it creates it.
</p>
<h2>
<a href="#types" rel="nofollow">
<span></span>
</a>
Types
</h2>
<h3>
<a href="#type-garlic" rel="nofollow">
<span></span>
</a>
type
<a href="/garlic.go#L19" rel="nofollow">
Garlic
</a>
</h3>
<p>
<code>
type Garlic struct { ... }
</code>
</p>
<p>
Garlic is a ready-made I2P streaming manager. Once initialized it always
has a valid I2PKeys and StreamSession.
</p>
<h4>
<a href="#func-newgarlic" rel="nofollow">
<span></span>
</a>
func
<a href="/garlic.go#L140" rel="nofollow">
NewGarlic
</a>
</h4>
<p>
<code>
func NewGarlic(tunName, samAddr string, options []string) (*Garlic, error)
</code>
</p>
<p>
NewGarlic returns a new Garlic struct. It is immediately ready to use with
I2P streaming.
</p>
<h4>
<a href="#func-garlic-close" rel="nofollow">
<span></span>
</a>
func (*Garlic)
<a href="/garlic.go#L111" rel="nofollow">
Close
</a>
</h4>
<p>
<code>
func (g *Garlic) Close() error
</code>
</p>
<p>
Close closes the Garlic structure's sessions and listeners.
</p>
<h4>
<a href="#func-garlic-deletekeys" rel="nofollow">
<span></span>
</a>
func (*Garlic)
<a href="/garlic.go#L134" rel="nofollow">
DeleteKeys
</a>
</h4>
<p>
<code>
func (g *Garlic) DeleteKeys() error
</code>
</p>
<h4>
<a href="#func-garlic-dial" rel="nofollow">
<span></span>
</a>
func (*Garlic)
<a href="/garlic.go#L99" rel="nofollow">
Dial
</a>
</h4>
<p>
<code>
func (g *Garlic) Dial(net, addr string) (net.Conn, error)
</code>
</p>
<p>
Dial returns a net.Conn for the Garlic structure's I2P keys.
</p>
<h4>
<a href="#func-garlic-keys" rel="nofollow">
<span></span>
</a>
func (*Garlic)
<a href="/garlic.go#L126" rel="nofollow">
Keys
</a>
</h4>
<p>
<code>
func (g *Garlic) Keys() (i2pkeys.I2PKeys, error)
</code>
</p>
<p>
Keys returns the I2PKeys for the Garlic structure. If none
exist, they are created and stored.
</p>
<h4>
<a href="#func-garlic-listen" rel="nofollow">
<span></span>
</a>
func (*Garlic)
<a href="/garlic.go#L81" rel="nofollow">
Listen
</a>
</h4>
<p>
<code>
func (g *Garlic) Listen() (net.Listener, error)
</code>
</p>
<p>
Listen returns a net.Listener for the Garlic structure's I2P keys.
</p>
<h3>
<a href="#type-onion" rel="nofollow">
<span></span>
</a>
type
<a href="/onion.go#L24" rel="nofollow">
Onion
</a>
</h3>
<p>
<code>
type Onion struct { ... }
</code>
</p>
<p>
Onion represents a structure which manages an onion service and
a Tor client. The onion service will automatically have persistent
keys.
</p>
<h4>
<a href="#func-newonion" rel="nofollow">
<span></span>
</a>
func
<a href="/onion.go#L126" rel="nofollow">
NewOnion
</a>
</h4>
<p>
<code>
func NewOnion(name string) (*Onion, error)
</code>
</p>
<p>
NewOnion returns a new Onion object.
</p>
<h4>
<a href="#func-onion-close" rel="nofollow">
<span></span>
</a>
func (*Onion)
<a href="/onion.go#L109" rel="nofollow">
Close
</a>
</h4>
<p>
<code>
func (o *Onion) Close() error
</code>
</p>
<p>
Close closes the Onion Service and all associated resources.
</p>
<h4>
<a href="#func-onion-deletekeys" rel="nofollow">
<span></span>
</a>
func (*Onion)
<a href="/onion.go#L121" rel="nofollow">
DeleteKeys
</a>
</h4>
<p>
<code>
func (g *Onion) DeleteKeys() error
</code>
</p>
<p>
DeleteKeys deletes the keys at the given key name in the key store.
This is permanent and irreversible, and will change the onion service
address.
</p>
<h4>
<a href="#func-onion-dial" rel="nofollow">
<span></span>
</a>
func (*Onion)
<a href="/onion.go#L104" rel="nofollow">
Dial
</a>
</h4>
<p>
<code>
func (o *Onion) Dial(net, addr string) (net.Conn, error)
</code>
</p>
<p>
Dial returns a net.Conn to the given onion address or clearnet address.
</p>
<h4>
<a href="#func-onion-keys" rel="nofollow">
<span></span>
</a>
func (*Onion)
<a href="/onion.go#L114" rel="nofollow">
Keys
</a>
</h4>
<p>
<code>
func (o *Onion) Keys() (ed25519.KeyPair, error)
</code>
</p>
<p>
Keys returns the keys for the Onion
</p>
<h4>
<a href="#func-onion-listen" rel="nofollow">
<span></span>
</a>
func (*Onion)
<a href="/onion.go#L99" rel="nofollow">
Listen
</a>
</h4>
<p>
<code>
func (o *Onion) Listen() (net.Listener, error)
</code>
</p>
<p>
ListenOnion returns a net.Listener which will listen on an onion
address, and will automatically generate a keypair and store it.
</p>
<hr>
<p>
Readme created from Go doc with
<a href="https://github.com/posener/goreadme" rel="nofollow">
goreadme
</a>
</p>
<div id="sourcecode">
<ul>
<li>
<a href="https://github.com/eyedeekay/onramp.git">
Source Code: (https://github.com/eyedeekay/onramp.git)
</a>
</li>
</ul>
</div>
<div>
<a href="#show">
Show license
</a>
<div id="show">
<div id="hide">
<pre><code>MIT License
Copyright (c) 2022 idk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</code></pre>
<a href="#hide">
Hide license
</a>
</div>
</div>
</div>
<div>
<iframe src="https://snowflake.torproject.org/embed.html" width="320" height="240" frameborder="0" scrolling="no"></iframe>
</div>
<div>
<a href="https://geti2p.net/">
<img src="i2plogo.png"></img>
I2P
</a>
</div>
</body>
</html>