Documentation
¶
Index ¶
- Constants
- type AuthData
- type AuthMethod
- type Cmd
- type Controller
- func (c *Controller) Authenticate(method AuthMethod, data AuthData) error
- func (c *Controller) HSDescAvailable(addr string) (bool, error)
- func (c *Controller) NewIdentity() error
- func (c *Controller) Open(addr string) error
- func (c *Controller) RegisterEvent(code EventCode, callback func([]ReplyLine)) error
- func (c *Controller) UnregisterEvent(code EventCode) error
- type ErrAuthenticationRequired
- type ErrBadAuthentication
- type ErrInternal
- type ErrInvalidConfigurationValue
- type ErrInvalidDescriptor
- type ErrOperationUnnecessary
- type ErrProtocolSyntaxError
- type ErrResourceExhausted
- type ErrSyntaxCommandArgument
- type ErrUnimplementedCommand
- type ErrUnknown
- type ErrUnmanagedEntity
- type ErrUnrecognizedCommand
- type ErrUnrecognizedCommandArgument
- type ErrUnrecognizedEntity
- type ErrUnspecified
- type EventCode
- type HSAuthConfig
- type HSConfigReply
- type HSPortConfig
- type KeyType
- type LowController
- func (c *LowController) AddOnion(keyType KeyType, keyBlob string, flags []string, maxStreams uint16, ...) (*HSConfigReply, error)
- func (c *LowController) AuthChallenge(chllngType string, clientNonce []byte) (serverHash []byte, serverNonce []byte, err error)
- func (c *LowController) AuthenticateBytes(data []byte) error
- func (c *LowController) AuthenticateNull() error
- func (c *LowController) AuthenticateString(data string) error
- func (c *LowController) DelOnion(HSAddr string) error
- func (c *LowController) DropOwnership() error
- func (c *LowController) DropTimeouts() error
- func (c *LowController) GetConf(names []string) (map[string]string, error)
- func (c *LowController) GetInfo(keywords []string) (map[string]string, error)
- func (c *LowController) GetProtocolInfo(versions []string) (*ProtocolInfo, error)
- func (c *LowController) HSFetch(addressOrDescriptor string, servers []string) error
- func (c *LowController) HSPost(servers []string, HSAddr string, descriptor string) error
- func (c *LowController) OnionClientAuthAdd(auth OnionClientAuth) error
- func (c *LowController) OnionClientAuthRemove(HSAddr string) error
- func (c *LowController) OnionClientAuthView(HSAddr string) ([]OnionClientAuth, error)
- func (c *LowController) Open(addr string) (err error)
- func (c *LowController) Quit() error
- func (c *LowController) ResetConf(confs map[string]string) error
- func (c *LowController) Resolve(addr string, reverse bool) error
- func (c *LowController) SaveConf(force bool) error
- func (c *LowController) SendSignal(signal Signal) error
- func (c *LowController) SetConf(confs map[string]string) error
- func (c *LowController) SetEvents(codes []string) error
- func (c *LowController) TakeOwnership() error
- func (c *LowController) UseFeature(features []string) error
- type OnionClientAuth
- type ProtocolInfo
- type ReplyLine
- type Signal
Constants ¶
const ( GENERATE_BEST = "BEST" GENERATE_RSA1024 = "RSA1024" GENERATE_ED25519_V3 = "ED25519-V3" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthData ¶
AuthData declares the data passed for authentication.
- Password may be declared for AUTH_HASHEDPASSWORD authentication.
- CookieData may be declared to pass a cookie-file's contents manually. If CookieData is nil, AUTH_COOKIE and AUTH_SAFECOOKIE authentication will read the first available cookie-file's contents automatically.
type AuthMethod ¶
type AuthMethod string
AuthMethod declares the way of authentication on the ControlPort connection.
const ( // AUTH_NULL No authentication is required. // // To prevent cross-protocol attacks, calling authenticate is still required, even when all methods are disabled. AUTH_NULL AuthMethod = "NULL" // AUTH_HASHEDPASSWORD A password needs to be presented. // // The password's hash is defined in the configuration. AUTH_HASHEDPASSWORD AuthMethod = "HASHEDPASSWORD" // AUTH_COOKIE A cookie-file's contents must be provided. // // The Controller needs to prove its privileges to read one of them. AUTH_COOKIE AuthMethod = "COOKIE" // AUTH_SAFECOOKIE A Challenge must be completed // // The Controller needs to prove its knowledge of a cookie-file, similar to AUTH_COOKIE. AUTH_SAFECOOKIE AuthMethod = "SAFECOOKIE" )
type Cmd ¶
type Cmd string
Cmd represents a direct command on the ControlPort protocol
Usage of Cmd outside the module itself will be mostly obsolete once all commands are implemented on the LowController API.
const ( CMD_SETCONF Cmd = "SETCONF" CMD_RESETCONF Cmd = "RESETCONF" CMD_GETCONF Cmd = "GETCONF" CMD_SETEVENTS Cmd = "SETEVENTS" CMD_AUTHENTICATE Cmd = "AUTHENTICATE" CMD_SAVECONF Cmd = "SAVECONF" CMD_SIGNAL Cmd = "SIGNAL" CMD_MAPADDRESS Cmd = "MAPADDRESS" CMD_GETINFO Cmd = "GETINFO" CMD_EXTENDCIRCUIT Cmd = "EXTENDCIRCUIT" CMD_SETCIRCUITPURPOSE Cmd = "SETCIRCUITPURPOSE" CMD_SETROUTERPURPOSE Cmd = "SETROUTERPURPOSE" CMD_ATTACHSTREAM Cmd = "ATTACHSTREAM" CMD_POSTDESCRIPTOR Cmd = "POSTDESCRIPTOR" CMD_REDIRECTSTREAM Cmd = "REDIRECTSTREAM" CMD_CLOSESTREAM Cmd = "CLOSESTREAM" CMD_CLOSECIRCUIT Cmd = "CLOSECIRCUIT" CMD_QUIT Cmd = "QUIT" CMD_USEFEATURE Cmd = "USEFEATURE" CMD_RESOLVE Cmd = "RESOLVE" CMD_PROTOCOLINFO Cmd = "PROTOCOLINFO" CMD_LOADCONF Cmd = "LOADCONF" CMD_TAKEOWNERSHIP Cmd = "TAKEOWNERSHIP" CMD_AUTHCHALLENGE Cmd = "AUTHCHALLENGE" CMD_DROPGUARDS Cmd = "DROPGUARDS" CMD_HSFETCH Cmd = "HSFETCH" CMD_ADD_ONION Cmd = "ADD_ONION" CMD_DEL_ONION Cmd = "DEL_ONION" CMD_HSPOST Cmd = "+HSPOST" CMD_ONION_CLIENT_AUTH_ADD Cmd = "ONION_CLIENT_AUTH_ADD" CMD_ONION_CLIENT_AUTH_REMOVE Cmd = "ONION_CLIENT_AUTH_REMOVE" CMD_ONION_CLIENT_AUTH_VIEW Cmd = "ONION_CLIENT_AUTH_VIEW" CMD_DROPOWNERSHIP Cmd = "DROPOWNERSHIP" CMD_DROPTIMEOUTS Cmd = "DROPTIMEOUTS" )
type Controller ¶
type Controller struct {
TorVersion string
TorRCPath string
VersionStatus string
LowController *LowController
// contains filtered or unexported fields
}
Controller provides a high-level API for communication over TOR's ControlPort protocol.
Certain functions may declare high concurrency-safety.
func NewController ¶
func NewController() *Controller
func (*Controller) Authenticate ¶
func (c *Controller) Authenticate(method AuthMethod, data AuthData) error
Authenticate the connection using the given AuthMethod and (if required) AuthData
This function is fully thread-safe, although there shouldn't be any scenario, where that's applicable
func (*Controller) HSDescAvailable ¶
func (c *Controller) HSDescAvailable(addr string) (bool, error)
HSDescAvailable checks for the availability of the given hidden service on the hash-ring. This usually means, that the hidden service is reachable.
This function is fully thread-safe
func (*Controller) NewIdentity ¶
func (c *Controller) NewIdentity() error
NewIdentity switches to new circuits, so that new requests don't share any circuits with old ones.
This function is fully thread-safe, although TOR might rate-limit its usage.
func (*Controller) Open ¶
func (c *Controller) Open(addr string) error
func (*Controller) RegisterEvent ¶
func (c *Controller) RegisterEvent(code EventCode, callback func([]ReplyLine)) error
RegisterEvent sets the callback function for the given event.
This function is fully thread-safe.
func (*Controller) UnregisterEvent ¶
func (c *Controller) UnregisterEvent(code EventCode) error
UnregisterEvent removes the set callback function for the given event.
This function is fully thread-safe.
type ErrAuthenticationRequired ¶
type ErrAuthenticationRequired error
type ErrBadAuthentication ¶
type ErrBadAuthentication error
type ErrInternal ¶
type ErrInternal error
type ErrInvalidConfigurationValue ¶
type ErrInvalidConfigurationValue error
type ErrInvalidDescriptor ¶
type ErrInvalidDescriptor error
type ErrOperationUnnecessary ¶
type ErrOperationUnnecessary error
type ErrProtocolSyntaxError ¶
type ErrProtocolSyntaxError error
type ErrResourceExhausted ¶
type ErrResourceExhausted error
type ErrSyntaxCommandArgument ¶
type ErrSyntaxCommandArgument error
type ErrUnimplementedCommand ¶
type ErrUnimplementedCommand error
type ErrUnknown ¶
type ErrUnknown error
type ErrUnmanagedEntity ¶
type ErrUnmanagedEntity error
type ErrUnrecognizedCommand ¶
type ErrUnrecognizedCommand error
type ErrUnrecognizedCommandArgument ¶
type ErrUnrecognizedCommandArgument error
type ErrUnrecognizedEntity ¶
type ErrUnrecognizedEntity error
type ErrUnspecified ¶
type ErrUnspecified error
type EventCode ¶
type EventCode string
const ( EVENT_CIRC EventCode = "CIRC" EVENT_STREAM EventCode = "STREAM" EVENT_ORCONN EventCode = "ORCONN" EVENT_BW EventCode = "BW" EVENT_DEBUG EventCode = "DEBUG" EVENT_INFO EventCode = "INFO" EVENT_NOTICE EventCode = "NOTICE" EVENT_WARN EventCode = "WARN" EVENT_ERR EventCode = "ERR" EVENT_NEWDESC EventCode = "NEWDESC" EVENT_ADDRMAP EventCode = "ADDRMAP" EVENT_AUTHDIR_NEWDESCS EventCode = "AUTHDIR_NEWDESCS" EVENT_DESCCHANGED EventCode = "DESCCHANGED" EVENT_STATUS_GENERAL EventCode = "STATUS_GENERAL" EVENT_STATUS_CLIENT EventCode = "STATUS_CLIENT" EVENT_STATUS_SERVER EventCode = "STATUS_SERVER" EVENT_GUARD EventCode = "GUARD" EVENT_NS EventCode = "NS" EVENT_STREAM_BW EventCode = "STREAM_BW" EVENT_CLIENTS_SEEN EventCode = "CLIENTS_SEEN" EVENT_NEWCONSENSUS EventCode = "NEWCONSENSUS" EVENT_BUILDTIMEOUT_SET EventCode = "BUILDTIMEOUT_SET" EVENT_SIGNAL EventCode = "SIGNAL" EVENT_CONF_CHANGED EventCode = "CONF_CHANGED" EVENT_CIRC_MINOR EventCode = "CIRC_MINOR" EVENT_TRANSPORT_LAUNCHED EventCode = "TRANSPORT_LAUNCHED" EVENT_CONN_BW EventCode = "CONN_BW" EVENT_CIRC_BW EventCode = "CIRC_BW" EVENT_CELL_STATS EventCode = "CELL_STATS" EVENT_TB_EMPTY EventCode = "TB_EMPTY" EVENT_HS_DESC EventCode = "HS_DESC" EVENT_HS_DESC_CONTENT EventCode = "HS_DESC_CONTENT" EVENT_NETWORK_LIVENESS EventCode = "NETWORK_LIVENESS" EVENT_PT_LOG EventCode = "PT_LOG" EVENT_PT_STATUS EventCode = "PT_STATUS" )
type HSAuthConfig ¶ added in v0.0.3
type HSConfigReply ¶ added in v0.0.3
type HSConfigReply struct {
ServiceID string
// contains filtered or unexported fields
}
type HSPortConfig ¶ added in v0.0.3
type KeyType ¶ added in v0.0.3
type KeyType string
const ( // KEYTYPE_X25519 Only for use in OnionClientAuth KEYTYPE_X25519 KeyType = "x25519" // KEYTYPE_NEW pseudo-keytype, only for use in LowController.AddOnion KEYTYPE_NEW KeyType = "NEW" // KEYTYPE_RSA1024 Only for use in LowController.AddOnion KEYTYPE_RSA1024 KeyType = "RSA1024" // KEYTYPE_ED25519_V3 Only for use in LowController.AddOnion KEYTYPE_ED25519_V3 KeyType = "ED25519-V3" )
type LowController ¶
type LowController struct {
NotificationChan chan []ReplyLine
// contains filtered or unexported fields
}
LowController provides a low-level API for communication over TOR's ControlPort protocol.
All exported functions are concurrency-safe. Since TOR processes commands sequentially,
func NewLowController ¶
func NewLowController() *LowController
func (*LowController) AddOnion ¶ added in v0.0.3
func (c *LowController) AddOnion(keyType KeyType, keyBlob string, flags []string, maxStreams uint16, ports []HSPortConfig, auths []HSAuthConfig) (*HSConfigReply, error)
func (*LowController) AuthChallenge ¶
func (*LowController) AuthenticateBytes ¶
func (c *LowController) AuthenticateBytes(data []byte) error
func (*LowController) AuthenticateNull ¶
func (c *LowController) AuthenticateNull() error
func (*LowController) AuthenticateString ¶
func (c *LowController) AuthenticateString(data string) error
func (*LowController) DelOnion ¶ added in v0.0.3
func (c *LowController) DelOnion(HSAddr string) error
func (*LowController) DropOwnership ¶ added in v0.0.3
func (c *LowController) DropOwnership() error
func (*LowController) DropTimeouts ¶ added in v0.0.3
func (c *LowController) DropTimeouts() error
func (*LowController) GetConf ¶
func (c *LowController) GetConf(names []string) (map[string]string, error)
func (*LowController) GetInfo ¶
func (c *LowController) GetInfo(keywords []string) (map[string]string, error)
func (*LowController) GetProtocolInfo ¶
func (c *LowController) GetProtocolInfo(versions []string) (*ProtocolInfo, error)
func (*LowController) HSFetch ¶
func (c *LowController) HSFetch(addressOrDescriptor string, servers []string) error
func (*LowController) HSPost ¶ added in v0.0.3
func (c *LowController) HSPost(servers []string, HSAddr string, descriptor string) error
func (*LowController) OnionClientAuthAdd ¶ added in v0.0.3
func (c *LowController) OnionClientAuthAdd(auth OnionClientAuth) error
func (*LowController) OnionClientAuthRemove ¶ added in v0.0.3
func (c *LowController) OnionClientAuthRemove(HSAddr string) error
func (*LowController) OnionClientAuthView ¶ added in v0.0.3
func (c *LowController) OnionClientAuthView(HSAddr string) ([]OnionClientAuth, error)
func (*LowController) Open ¶
func (c *LowController) Open(addr string) (err error)
func (*LowController) Quit ¶
func (c *LowController) Quit() error
func (*LowController) SaveConf ¶
func (c *LowController) SaveConf(force bool) error
func (*LowController) SendSignal ¶
func (c *LowController) SendSignal(signal Signal) error
func (*LowController) SetEvents ¶
func (c *LowController) SetEvents(codes []string) error
func (*LowController) TakeOwnership ¶ added in v0.0.3
func (c *LowController) TakeOwnership() error
func (*LowController) UseFeature ¶ added in v0.0.3
func (c *LowController) UseFeature(features []string) error
type OnionClientAuth ¶ added in v0.0.3
type ProtocolInfo ¶
type Signal ¶
type Signal string
const ( SIGNAL_RELOAD Signal = "RELOAD" SIGNAL_SHUTDOWN Signal = "SHUTDOWN" SIGNAL_DUMP Signal = "DUMP" SIGNAL_DEBUG Signal = "DEBUG" SIGNAL_HALT Signal = "HALT" SIGNAL_CLEARDNSCACHE Signal = "CLEARDNSCACHE" SIGNAL_NEWNYM Signal = "NEWNYM" SIGNAL_HEARTBEAT Signal = "HEARTBEAT" SIGNAL_DORMANT Signal = "DORMANT" SIGNAL_ACTIVE Signal = "ACTIVE" )