Documentation ¶
Overview ¶
Package torutil has generic utilities shared across the library.
Index ¶
- func EscapeSimpleQuotedString(str string) string
- func EscapeSimpleQuotedStringContents(str string) string
- func EscapeSimpleQuotedStringIfNeeded(str string) string
- func OnionServiceIDFromPrivateKey(key crypto.PrivateKey) string
- func OnionServiceIDFromPublicKey(key crypto.PublicKey) string
- func OnionServiceIDFromV2PublicKey(key *rsa.PublicKey) string
- func OnionServiceIDFromV3PublicKey(key ed25519.PublicKey) string
- func PartitionString(str string, ch byte) (string, string, bool)
- func PartitionStringFromEnd(str string, ch byte) (string, string, bool)
- func PublicKeyFromV3OnionServiceID(id string) (ed25519.PublicKey, error)
- func UnescapeSimpleQuotedString(str string) (string, error)
- func UnescapeSimpleQuotedStringContents(str string) (string, error)
- func UnescapeSimpleQuotedStringIfNeeded(str string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeSimpleQuotedString ¶
EscapeSimpleQuotedString calls EscapeSimpleQuotedStringContents and then surrounds the entire string with double quotes.
func EscapeSimpleQuotedStringContents ¶
EscapeSimpleQuotedStringContents escapes backslashes, double quotes, newlines, and carriage returns in str.
func EscapeSimpleQuotedStringIfNeeded ¶
EscapeSimpleQuotedStringIfNeeded calls EscapeSimpleQuotedString only if the string contains a space, backslash, double quote, newline, or carriage return character.
func OnionServiceIDFromPrivateKey ¶
func OnionServiceIDFromPrivateKey(key crypto.PrivateKey) string
OnionServiceIDFromPrivateKey generates the onion service ID from the given private key. This panics if the private key is not a 1024-bit crypto/*rsa.PrivateKey or github.com/papr8ka/bine/torutil/ed25519.KeyPair.
func OnionServiceIDFromPublicKey ¶
OnionServiceIDFromPublicKey generates the onion service ID from the given public key. This panics if the public key is not a 1024-bit crypto/*rsa.PublicKey or github.com/papr8ka/bine/torutil/ed25519.PublicKey.
func OnionServiceIDFromV2PublicKey ¶
OnionServiceIDFromV2PublicKey generates a V2 service ID for the given RSA-1024 public key. Panics if not a 1024-bit key.
func OnionServiceIDFromV3PublicKey ¶
OnionServiceIDFromV3PublicKey generates a V3 service ID for the given ED25519 public key.
func PartitionString ¶
PartitionString returns the two parts of a string delimited by the first occurrence of ch. If ch does not exist, the second string is empty and the resulting bool is false. Otherwise it is true.
func PartitionStringFromEnd ¶
PartitionStringFromEnd is same as PartitionString except it delimts by the last occurrence of ch instead of the first.
func PublicKeyFromV3OnionServiceID ¶
PublicKeyFromV3OnionServiceID returns a public key for the given service ID or an error if the service ID is invalid.
func UnescapeSimpleQuotedString ¶
UnescapeSimpleQuotedString removes surrounding double quotes and calls UnescapeSimpleQuotedStringContents.
func UnescapeSimpleQuotedStringContents ¶
UnescapeSimpleQuotedStringContents unescapes backslashes, double quotes, newlines, and carriage returns. Also errors if those aren't escaped.
func UnescapeSimpleQuotedStringIfNeeded ¶
UnescapeSimpleQuotedStringIfNeeded calls UnescapeSimpleQuotedString only if str is surrounded with double quotes.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package ed25519 implements Tor/BitTorrent-like ed25519 keys.
|
Package ed25519 implements Tor/BitTorrent-like ed25519 keys. |
Package geoipembed contains embedded db files for GeoIP.
|
Package geoipembed contains embedded db files for GeoIP. |