Documentation
¶
Overview ¶
Package tordn provides the ability to generate tor v3 onion address.
By Md Kawser Munshi
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeV3OnionAddressWithExtension ¶
MakeV3OnionAddressWithExtension generates tor v3 onion address with .onion extension
func PublicKeyToV3Address ¶
PublicKeyToV3Address generates tor v3 onion address from the publicKey
Types ¶
type TORDomainNameGenerator ¶
type TORDomainNameGenerator interface {
// GenerateTORDomainName generates tor domain using the secret key.
//
// Implementations must handle nil secretKey
GenerateTORDomainName(secretKey io.Reader) (publicKey []byte, privateKey []byte, onionAddress []byte, err error)
}
TORDomainNameGenerator basic interface
type V3 ¶
type V3 struct {
}
V3 TOR address generator
func (*V3) GenerateTORDomainName ¶
func (g *V3) GenerateTORDomainName(secretKey io.Reader) (publicKey []byte, privateKey []byte, onionAddress []byte, err error)
GenerateTORDomainName implements TORDomainNameGenerator interface
Generate tor v3 domain name using the secretKey.
Example ¶
Generate v3 tor domain name
package main
import (
"bytes"
"fmt"
"github.com/mkawserm/tordn"
)
func main() {
v3domainName := &tordn.V3{}
// generate random v3 tor domain name
publicKey, privateKey, onionAddress, err := v3domainName.GenerateTORDomainName(nil)
if err == nil {
fmt.Printf("Public Key:")
fmt.Println(publicKey)
fmt.Printf("Private Key:")
fmt.Println(privateKey)
fmt.Printf("Onion Address:")
fmt.Println(string(onionAddress))
}
secretKey := []byte("eipuopkyhrisvmrlbghubnlxunzkwoij")
publicKey1, privateKey1, onionAddress1, err1 := v3domainName.GenerateTORDomainName(bytes.NewReader(secretKey))
if err1 == nil {
fmt.Printf("Public Key:")
fmt.Println(publicKey1)
fmt.Printf("Private Key:")
fmt.Println(privateKey1)
fmt.Printf("Onion Address:")
fmt.Println(string(onionAddress1))
}
}
Click to show internal directories.
Click to hide internal directories.