update index.html

This commit is contained in:
idk
2022-08-04 00:02:05 -04:00
parent bc73f72bb1
commit 5e576d9d4a
5 changed files with 123 additions and 14 deletions

37
DOCS.md
View File

@ -34,21 +34,40 @@ var SAM_ADDR = "127.0.0.1:7656"
## Functions
### func [Close](/garlic.go#L200)
### func [Close](/garlic.go#L218)
`func Close(tunName string)`
Close closes the Garlic at the given index. It does not affect Garlic
objects instantiated by an app.
### func [CloseAll](/garlic.go#L191)
### func [CloseAll](/garlic.go#L209)
`func CloseAll()`
Close() closes all garlics managed by the onramp package. It does not
affect objects instantiated by an app.
### func [Dial](/garlic.go#L226)
### func [DeleteI2PKeyStore](/common.go#L57)
`func DeleteI2PKeyStore() error`
DeleteI2PKeyStore deletes the I2P Keystore.
### func [DeleteKeys](/garlic.go#L157)
`func DeleteKeys(tunName string) error`
DeleteKeys deletes the key file at the given path as determined by
keystore + tunName.
### func [DeleteTorKeyStore](/common.go#L75)
`func DeleteTorKeyStore() error`
DeleteTorKeyStore deletes the Onion Keystore.
### func [Dial](/garlic.go#L244)
`func Dial(network, addr string) (net.Conn, error)`
@ -62,7 +81,7 @@ and not instantiated by an app.
GetJoinedWD returns the working directory joined with the given path.
### func [I2PKeys](/garlic.go#L153)
### func [I2PKeys](/garlic.go#L171)
`func I2PKeys(tunName, samAddr string) (i2pkeys.I2PKeys, error)`
@ -77,7 +96,7 @@ 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.
### func [Listen](/garlic.go#L214)
### func [Listen](/garlic.go#L232)
`func Listen(network, keys string) (net.Listener, error)`
@ -85,7 +104,7 @@ Listen 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.
### func [TorKeystorePath](/common.go#L59)
### func [TorKeystorePath](/common.go#L64)
`func TorKeystorePath() (string, error)`
@ -102,7 +121,7 @@ not exist, it creates it.
Garlic is a ready-made I2P streaming manager. Once initialized it always
has a valid I2PKeys and StreamSession.
#### func [NewGarlic](/garlic.go#L136)
#### func [NewGarlic](/garlic.go#L140)
`func NewGarlic(tunName, samAddr string, options []string) (*Garlic, error)`
@ -115,6 +134,10 @@ I2P streaming.
Close closes the Garlic structure's sessions and listeners.
#### func (*Garlic) [DeleteKeys](/garlic.go#L134)
`func (g *Garlic) DeleteKeys() error`
#### func (*Garlic) [Dial](/garlic.go#L99)
`func (g *Garlic) Dial(net, addr string) (net.Conn, error)`

View File

@ -6,8 +6,25 @@ Provides only the most widely-used functions in a basic way. It expects nothing
from the users, an otherwise empty instance of the structs will listen and dial
I2P Streaming and Tor TCP sessions successfully.
I2P(Garlic) Usage:
------------------
In all cases, it assumes that keys are "persistent" in that they are managed
maintained between usages of the same application in the same configuration.
This means that hidden services will maintain their identities, and that clients
will always have the same return addresses. If you don't want this behavior,
make sure to delete the "keystore" when your app closes or when your application
needs to cycle keys by calling the `Garlic.DeleteKeys()` function.
Usage
-----
Basic usage is designed to be very simple, import the package and instantiate
a struct and you're ready to go.
For more extensive examples, see: [EXAMPLE](example.md)
### I2P(Garlic) Usage:
When using it to manage an I2P session, set up an `onramp.Garlic`
struct.
```Go
package main
@ -29,8 +46,10 @@ func main() {
}
```
Tor(Onion) Usage:
-----------------
### Tor(Onion) Usage:
When using it to manage a Tor session, set up an `onramp.Onion`
struct.
```Go
package main

View File

@ -53,6 +53,11 @@ func I2PKeystorePath() (string, error) {
return I2P_KEYSTORE_PATH, nil
}
// DeleteI2PKeyStore deletes the I2P Keystore.
func DeleteI2PKeyStore() error {
return os.RemoveAll(I2P_KEYSTORE_PATH)
}
// 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.
@ -65,3 +70,8 @@ func TorKeystorePath() (string, error) {
}
return ONION_KEYSTORE_PATH, nil
}
// DeleteTorKeyStore deletes the Onion Keystore.
func DeleteTorKeyStore() error {
return os.RemoveAll(ONION_KEYSTORE_PATH)
}

View File

@ -131,6 +131,10 @@ func (g *Garlic) Keys() (i2pkeys.I2PKeys, error) {
return keys, nil
}
func (g *Garlic) DeleteKeys() error {
return DeleteKeys(g.getName())
}
// NewGarlic returns a new Garlic struct. It is immediately ready to use with
// I2P streaming.
func NewGarlic(tunName, samAddr string, options []string) (*Garlic, error) {
@ -148,6 +152,20 @@ func NewGarlic(tunName, samAddr string, options []string) (*Garlic, error) {
return g, nil
}
// DeleteKeys deletes the key file at the given path as determined by
// keystore + tunName.
func DeleteKeys(tunName string) error {
keystore, err := I2PKeystorePath()
if err != nil {
return fmt.Errorf("onramp DeleteKeys: discovery error %v", err)
}
keyspath := filepath.Join(keystore, tunName+".i2p.private")
if err := os.Remove(keyspath); err != nil {
return fmt.Errorf("onramp DeleteKeys: %v", err)
}
return nil
}
// I2PKeys returns the I2PKeys at the keystore directory for the given
// tunnel name. If none exist, they are created and stored.
func I2PKeys(tunName, samAddr string) (i2pkeys.I2PKeys, error) {

View File

@ -50,9 +50,41 @@
from the users, an otherwise empty instance of the structs will listen and dial
I2P Streaming and Tor TCP sessions successfully.
</p>
<p>
In all cases, it assumes that keys are “persistent” in that they are managed
maintained between usages of the same application in the same configuration.
This means that hidden services will maintain their identities, and that clients
will always have the same return addresses. If you dont want this behavior,
make sure to delete the “keystore” when your app closes or when your application
needs to cycle keys by calling the
<code>
Garlic.DeleteKeys()
</code>
function.
</p>
<h2>
I2P(Garlic) Usage:
Usage
</h2>
<p>
Basic usage is designed to be very simple, import the package and instantiate
a struct and youre ready to go.
</p>
<p>
For more extensive examples, see:
<a href="example.md" rel="nofollow">
EXAMPLE
</a>
</p>
<h3>
I2P(Garlic) Usage:
</h3>
<p>
When using it to manage an I2P session, set up an
<code>
onramp.Garlic
</code>
struct.
</p>
<pre><code>package main
import(
@ -71,9 +103,16 @@ func main() {
defer listener.Close()
}
</code></pre>
<h2>
<h3>
Tor(Onion) Usage:
</h2>
</h3>
<p>
When using it to manage a Tor session, set up an
<code>
onramp.Onion
</code>
struct.
</p>
<pre><code>package main
import(