Documentation ¶
Index ¶
- Constants
- Variables
- func StartNKNServer(account *nkn.Account, identifier string, clientConfig *nkn.ClientConfig, ...) error
- func StartWebServer(listenAddr string, tun *tunnel.Tunnel, persistConf, mergedConf *config.Config) error
- type Client
- type GetInfoJSON
- type RpcReq
- type RpcResp
- type Token
- type TokenStore
- type UnixTime
Constants ¶
View Source
const ( TokenSize = 32 TokenExpiration = 10 * time.Minute TokenRotateInterval = 5 * time.Minute )
Variables ¶
View Source
var (
ErrReplyTimeout = errors.New("wait for reply timeout")
)
Functions ¶
func StartNKNServer ¶ added in v1.0.2
Types ¶
type Client ¶ added in v1.0.2
func (*Client) GetInfo ¶ added in v1.0.2
func (c *Client) GetInfo(addr string) (*GetInfoJSON, error)
type GetInfoJSON ¶ added in v1.0.2
type GetInfoJSON struct { Addr string `json:"addr"` LocalIP *localIPJSON `json:"localIP"` AdminHTTPAPIDisabled bool `json:"adminHttpApiDisabled"` Version string `json:"version"` Tuna bool `json:"tuna"` TunaServiceName string `json:"tunaServiceName,omitempty"` TunaCountry []string `json:"tunaCountry,omitempty"` InPrice []string `json:"inPrice,omitempty"` OutPrice []string `json:"outPrice,omitempty"` Tags []string `json:"tags,omitempty"` }
type RpcResp ¶ added in v1.2.0
type RpcResp struct { Result interface{} `json:"result,omitempty"` Error string `json:"error,omitempty"` }
type TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
func NewTokenStore ¶
func NewTokenStore(tokenExpiration, rotateInterval time.Duration) *TokenStore
func (*TokenStore) GetCurrentToken ¶
func (tr *TokenStore) GetCurrentToken() *Token
func (*TokenStore) IsValid ¶
func (tr *TokenStore) IsValid(token string) bool
func (*TokenStore) Start ¶
func (tr *TokenStore) Start()
Click to show internal directories.
Click to hide internal directories.