Documentation
¶
Index ¶
- Variables
- func GetFreePort() (int, error)
- func NewCmdAuth() *cobra.Command
- func NewCmdAuthLogin() *cobra.Command
- func NewCmdAuthLogout() *cobra.Command
- func NewCmdAuthSignup() *cobra.Command
- func NewCmdAuthWhoAmI() *cobra.Command
- func NewCmdOpen() *cobra.Command
- func NewCmdRoot() *cobra.Command
- func NewCmdRun() *cobra.Command
- func NewCmdServe() *cobra.Command
- func NewCmdServer() *cobra.Command
- func NewCmdUp() *cobra.Command
- func NewCmdUpgrade() *cobra.Command
- func PublicKeySha(key string) string
- type Client
- type ClientConfig
- type DB
- type Email
- type ErrorPayload
- type ErrorResponse
- type FetchInput
- type Forwarder
- type Handler
- type LoginParams
- type PublicKey
- type Request
- type RequestHeader
- type Response
- type ResponseHeader
- type ServerConfig
- type SignupParams
- type User
- type UserResponse
- type ValTownClient
- type VerifyEmailParams
- type WorkerEntrypoints
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMissingSSHAuth = errors.New("no SSH auth found")
)
View Source
var (
ErrMissingUser = errors.New("no user found")
)
Functions ¶
func GetFreePort ¶
GetFreePort asks the kernel for a free open port that is ready to use.
func NewCmdAuth ¶
func NewCmdAuthLogin ¶
func NewCmdAuthLogout ¶
func NewCmdAuthSignup ¶
func NewCmdAuthWhoAmI ¶
func NewCmdOpen ¶
func NewCmdRoot ¶
func NewCmdServe ¶
func NewCmdServer ¶
func NewCmdUpgrade ¶
func PublicKeySha ¶
PublicKeySha returns the SHA for a public key in hex format.
Types ¶
type Client ¶
type Client struct {
Config *ClientConfig
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(cfg *ClientConfig) (*Client, error)
func NewClientWithDefaults ¶
NewClientWithDefaults creates a new Charm client with default values.
type ClientConfig ¶
type ClientConfig struct {
Host string `env:"SMALLWEB_HOST" envDefault:"smallweb.run"`
SSHPort int `env:"SMALLWEB_SSH_PORT" envDefault:"22"`
Debug bool `env:"SMALLWEB_DEBUG" envDefault:"false"`
KeyType string `env:"SMALLWEB_KEY_TYPE" envDefault:"ed25519"`
DataDir string `env:"SMALLWEB_DATA_DIR" envDefault:""`
}
func ConfigFromEnv ¶
func ConfigFromEnv() (*ClientConfig, error)
ConfigFromEnv loads the configuration from the environment.
func (*ClientConfig) KeygenType ¶
func (cfg *ClientConfig) KeygenType() keygen.KeyType
KeygenType returns the keygen key type.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func NewTursoDB ¶
func (*DB) SetUserName ¶
SetUserName sets a user name for the given user id.
func (*DB) UserForKey ¶
UserForKey returns the user for the given key, or optionally creates a new user with it.
type Email ¶
type ErrorPayload ¶ added in v0.1.5
type ErrorPayload struct {
Message string
}
type ErrorResponse ¶
type FetchInput ¶
type Forwarder ¶
Forwarder can be enabled by creating a Forwarder and adding the HandleSSHRequest callback to the server's RequestHandlers under tcpip-forward and cancel-tcpip-forward.
type Handler ¶ added in v0.1.5
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶ added in v0.1.5
type LoginParams ¶
type LoginParams struct {
Email string
}
type PublicKey ¶
type PublicKey struct {
ID int `json:"id"`
UserID int `json:"user_id,omitempty"`
Key string `json:"key"`
CreatedAt *time.Time `json:"created_at"`
}
PublicKey represents to public SSH key for a Smallweb user.
type Request ¶
type RequestHeader ¶ added in v0.1.5
func (*RequestHeader) App ¶ added in v0.1.5
func (rh *RequestHeader) App() string
type ResponseHeader ¶ added in v0.1.5
type ServerConfig ¶
type ServerConfig struct {
Host string `env:"SMALLWEB_HOST" envDefault:"smallweb.run"`
SSHPort int `env:"SMALLWEB_SSH_PORT" envDefault:"2222"`
HttpPort int `env:"SMALLWEB_HTTP_PORT" envDefault:"8000"`
TursoDatabaseURL string `env:"TURSO_DATABASE_URL"`
TursoAuthToken string `env:"TURSO_AUTH_TOKEN"`
ValTownToken string `env:"VALTOWN_TOKEN"`
Debug bool `env:"SMALLWEB_DEBUG" envDefault:"false"`
}
func ServerConfigFromEnv ¶
func ServerConfigFromEnv() (*ServerConfig, error)
type SignupParams ¶
type UserResponse ¶
type ValTownClient ¶ added in v0.1.4
type ValTownClient struct {
// contains filtered or unexported fields
}
func NewValTownClient ¶ added in v0.1.4
func NewValTownClient(token string) *ValTownClient
func (*ValTownClient) SendEmail ¶ added in v0.1.4
func (me *ValTownClient) SendEmail(email Email) error
type VerifyEmailParams ¶
type VerifyEmailParams struct {
Code string
}
type WorkerEntrypoints ¶
Click to show internal directories.
Click to hide internal directories.