jumphelper

package
v0.0.0-...-eb1fbae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2018 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(host, port, book, samhost, samport string, subs []string, useh bool)

NewService quickly generates a service with host, port, book strings and fires off a goroutine

func Service

func Service()

Service quickly generates a service with the defaults.

func SetClientHost

func SetClientHost(s string) func(*Client) error

SetClientHost sets the host of the Server to connect to

func SetClientPort

func SetClientPort(s string) func(*Client) error

SetClientPort sets the port of the Server to connect to

func SetClientPortInt

func SetClientPortInt(s int) func(*Client) error

SetClientPortInt sets the port of the Server to connect to with an int

func SetClientVerbose

func SetClientVerbose(s bool) func(*Client) error

SetClientVerbose sets the verbosity of the client

func SetJumpHelperAddressBookPath

func SetJumpHelperAddressBookPath(s string) func(*JumpHelper) error

SetJumpHelperAddressBookPath sets the host of the JumpHelper client's SAM bridge

func SetJumpHelperHost

func SetJumpHelperHost(s string) func(*JumpHelper) error

SetJumpHelperHost sets the host of the JumpHelper client's SAM bridge

func SetJumpHelperPort

func SetJumpHelperPort(s string) func(*JumpHelper) error

SetJumpHelperPort sets the port of the JumpHelper client's SAM bridge

func SetJumpHelperPortInt

func SetJumpHelperPortInt(s int) func(*JumpHelper) error

SetJumpHelperPortInt sets the port of the JumpHelper client's SAM bridge with an int

func SetJumpHelperSubscription

func SetJumpHelperSubscription(s []string) func(*JumpHelper) error

SetJumpHelperSubscription sets the subscription list slice contents

func SetJumpHelperUseHelper

func SetJumpHelperUseHelper(s bool) func(*JumpHelper) error

SetJumpHelperUseHelper sets the host of the JumpHelper client's SAM bridge

func SetJumpHelperVerbosity

func SetJumpHelperVerbosity(s bool) func(*JumpHelper) error

SetJumpHelperVerbosity sets the verbosity for the server

func SetServerAddressBookPath

func SetServerAddressBookPath(s string) func(*Server) error

SetServerAddressBookPath sets the host of the Server client's SAM bridge

func SetServerBase32

func SetServerBase32(s string) func(*Server) error

SetServerBase32 sets the host of the Server client's SAM bridge

func SetServerBase64

func SetServerBase64(s string) func(*Server) error

SetServerBase64 sets the host of the Server client's SAM bridge

func SetServerBurst

func SetServerBurst(s int) func(*Server) error

SetServerBurst sets the host of the Server client's SAM bridge

func SetServerDifficulty

func SetServerDifficulty(s int) func(*Server) error

SetServerDifficulty sets the host of the Server client's SAM bridge

func SetServerEnableListing

func SetServerEnableListing(s bool) func(*Server) error

SetServerEnableListing Allows the server to export a list of addresses to others

func SetServerHost

func SetServerHost(s string) func(*Server) error

SetServerHost sets the host of the Server client's SAM bridge

func SetServerJumpHelperHost

func SetServerJumpHelperHost(s string) func(*Server) error

SetServerJumpHelperHost sets the host of the Jumphelper Server sync client's SAM bridge

func SetServerJumpHelperPort

func SetServerJumpHelperPort(s string) func(*Server) error

SetServerJumpHelperPort sets the port of the Jumphelper Server sync client's SAM bridge

func SetServerJumpHelperPortInt

func SetServerJumpHelperPortInt(s int) func(*Server) error

SetServerJumpHelperPortInt sets the port of the Jumphelper Server sync client's SAM bridge with an int

func SetServerJumpHelperVerbosity

func SetServerJumpHelperVerbosity(s bool) func(*Server) error

SetServerJumpHelperVerbosity sets the verbosity for the server

func SetServerPort

func SetServerPort(s string) func(*Server) error

SetServerPort sets the port of the Server client's SAM bridge

func SetServerPortInt

func SetServerPortInt(s int) func(*Server) error

SetServerPortInt sets the port of the Server client's SAM bridge with an int

func SetServerRate

func SetServerRate(s int) func(*Server) error

SetServerRate sets the host of the Server client's SAM bridge

func SetServerSubscription

func SetServerSubscription(s []string) func(*Server) error

SetServerSubscription sets the subscription list slice contents

func SetServerUseHelper

func SetServerUseHelper(s bool) func(*Server) error

SetServerUseHelper sets the host of the Server client's SAM bridge

func SetaddresslistAddressBookPath

func SetaddresslistAddressBookPath(s string) func(*addresslist) error

SetaddresslistAddressBookPath sets the host of the addresslist client's SAM bridge

func SetaddresslistHost

func SetaddresslistHost(s string) func(*addresslist) error

SetaddresslistHost sets the host of the addresslist client's SAM bridge

func SetaddresslistPort

func SetaddresslistPort(s string) func(*addresslist) error

SetaddresslistPort sets the port of the addresslist client's SAM bridge

func SetaddresslistPortInt

func SetaddresslistPortInt(s int) func(*addresslist) error

SetaddresslistPortInt sets the port of the addresslist client's SAM bridge with an int

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a HTTP client that makes jumphelper requests

func NewClient

func NewClient(Host, Port string, verbose bool) (*Client, error)

NewClient creates a new jumphelper client

func NewClientFromOptions

func NewClientFromOptions(opts ...func(*Client) error) (*Client, error)

NewClientFromOptions creates a new jumphelper client from functional arguments

func (*Client) Check

func (c *Client) Check(s string) (bool, error)

Check writes a request for a true-false answer to a jumphelper server

func (*Client) Jump

func (c *Client) Jump(s string) (string, error)

Jump writes a request for a base64 address to a jumphelper server

func (*Client) Log

func (c *Client) Log(s string) string

Log wraps Println to control verbosity.

func (*Client) Register

func (c *Client) Register(input, domain, base64 string) (string, error)

func (*Client) Request

func (c *Client) Request(s string) (string, error)

Request writes a request for a base32 answer to a jumphelper server

func (*Client) Signup

func (c *Client) Signup(domain, base64 string) (string, error)

Signup requests a new account for a domain from a jumphelper server

type ClientOption

type ClientOption func(*Client) error

ClientOption is a server option

type JumpHelper

type JumpHelper struct {
	TrustedAddressBook *addresslist
	// contains filtered or unexported fields
}

JumpHelper is a struct that prioritizes i2p address sources

func NewJumpHelper

func NewJumpHelper(addressBookPath, host, port string, subs []string, use bool) (*JumpHelper, error)

NewJumpHelper creates a new JumpHelper object

func NewJumpHelperFromOptions

func NewJumpHelperFromOptions(opts ...func(*JumpHelper) error) (*JumpHelper, error)

NewJumpHelperFromOptions creates a new JumpHelper object

func (*JumpHelper) CheckAddressBook

func (j *JumpHelper) CheckAddressBook(pk string) bool

CheckAddressBook returns true if an address is present, false if not

func (*JumpHelper) LoadAddressBook

func (j *JumpHelper) LoadAddressBook() error

LoadAddressBook loads an addressbook in csv(name, b32) format

func (*JumpHelper) SearchAddressBook

func (j *JumpHelper) SearchAddressBook(pk string) []string

SearchAddressBook finds a (name, b32) pair in the addressbook, or returns nil of one is not found

func (*JumpHelper) Subs

func (j *JumpHelper) Subs() []string

Subs Lists all the known address pairs

func (*JumpHelper) Vote

func (j *JumpHelper) Vote(pk string) int

Vote returns true if an address is present, false if not

type JumpHelperOption

type JumpHelperOption func(*JumpHelper) error

JumpHelperOption is a jumphelper option

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a TCP service that responds to addressbook requests

func NewServer

func NewServer(host, port, book, samhost, samport string, subs []string, useh, verbose, share bool, base32 string) (*Server, error)

NewServer creates a new Server that answers jump-related queries

func NewServerFromOptions

func NewServerFromOptions(opts ...func(*Server) error) (*Server, error)

NewServerFromOptions creates a new Server that answers jump-related queries

func (*Server) HandleAccount

func (s *Server) HandleAccount(w http.ResponseWriter, r *http.Request)

HandleAccount emits a problem for proof-of-work on the client

func (*Server) HandleBase32

func (s *Server) HandleBase32(w http.ResponseWriter, r *http.Request)

HandleBase32 lists all synced remote jumphelper urls.

func (*Server) HandleBase64

func (s *Server) HandleBase64(w http.ResponseWriter, r *http.Request)

HandleBase64 lists all synced remote jumphelper urls.

func (*Server) HandleExists

func (s *Server) HandleExists(w http.ResponseWriter, r *http.Request)

HandleExists prints true:address if an antecedent URL exists in the addressbook, false if not

func (*Server) HandleJump

func (s *Server) HandleJump(w http.ResponseWriter, r *http.Request)

HandleJump redirects to a base64 URL like a traditional jump service.

func (*Server) HandleListing

func (s *Server) HandleListing(w http.ResponseWriter, r *http.Request)

HandleListing lists all synced remote jumphelper urls.

func (*Server) HandleLookup

func (s *Server) HandleLookup(w http.ResponseWriter, r *http.Request)

HandleLookup redirects to a b32.i2p URL instead of behaving like a traditional jump service.

func (*Server) HandleProof

func (s *Server) HandleProof(w http.ResponseWriter, r *http.Request)

HandleProof emits a problem for proof-of-work on the client

func (*Server) HandlePush

func (s *Server) HandlePush(w http.ResponseWriter, r *http.Request)

HandlePush creates a signed list of addresses and pushes it to a requested URL

func (*Server) HandleRecv

func (s *Server) HandleRecv(w http.ResponseWriter, r *http.Request)

HandleRecv recieves a signed list of URL's from another server's HandlePush

func (*Server) HandleReflect32

func (s *Server) HandleReflect32(w http.ResponseWriter, r *http.Request)

HandleReflect32 replies back with the base32 of the client requesting it

func (*Server) HandleReflect64

func (s *Server) HandleReflect64(w http.ResponseWriter, r *http.Request)

HandleReflect64 replies back with the base64 of the client requesting it

func (*Server) HandleReflectBoth

func (s *Server) HandleReflectBoth(w http.ResponseWriter, r *http.Request)

HandleReflectBoth replies back with both the base32 and base64 of the client requesting it

func (*Server) HandleReflectHeaders

func (s *Server) HandleReflectHeaders(w http.ResponseWriter, r *http.Request)

func (*Server) NewMux

func (s *Server) NewMux() (*http.ServeMux, error)

NewMux sets up a new ServeMux with handlers

func (*Server) Rate

func (s *Server) Rate() rate.Limit

Rate returns the rate

func (*Server) Serve

func (s *Server) Serve()

Serve sets up a listening server on the specified port

type ServerOption

type ServerOption func(*Server) error

ServerOption is a server option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL