cmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argon2

type Argon2 struct {
	HashCommon

	Variant     string `name:"variant" enum:"i, id" help:"Variant of argon2 to use" default:"id"`
	Iterations  int    `name:"iterations" help:"Number of iterations to use" default:"10"`
	Memory      int    `name:"memory" help:"Memory to use in kibibytes" default:"64"`
	Parallelism int    `name:"parallelism" help:" Degree of parallelism to use" default:"1"`
}

func (*Argon2) Run

func (a *Argon2) Run() error

type Base

type Base struct {
	Log struct {
		Format string   `name:"format" enum:"text,json" help:"Log format" default:"json"`
		Level  LogLevel `name:"level" help:"Log level" default:"info"`
	} `embed:"" prefix:"log."`

	Version bool `name:"version" help:"Print version information and exit"`
}

func (Base) BeforeReset

func (b Base) BeforeReset(ctx *kong.Context) error

PrintVersionIfNeeded prints the version information and exits if the version flag is set.

func (Base) Logger

func (b Base) Logger() *slog.Logger

type Bcrypt

type Bcrypt struct {
	HashCommon

	Rounds int `name:"rounds" help:"Number of iterations to use as 2^rounds" default:"8"`
}

func (*Bcrypt) Run

func (b *Bcrypt) Run() error

type Hash

type Hash struct {
	Argon2 Argon2 `cmd:"" name:"argon2" help:"Argon2 hashing algorithm"`
	Scrypt Scrypt `cmd:"" name:"scrypt" help:"Scrypt hashing algorithm"`
	Bcrypt Bcrypt `cmd:"" name:"bcrypt" help:"Bcrypt hashing algorithm"`
	PBKDF2 PBKDF2 `cmd:"" name:"pbkdf2" help:"PBKDF2 hashing algorithm"`
}

type HashCommon

type HashCommon struct {
	Password string `arg:"" name:"password" help:"Password to hash" required:""`
	// contains filtered or unexported fields
}

type LogLevel

type LogLevel slog.Level

func (*LogLevel) Decode

func (l *LogLevel) Decode(ctx *kong.DecodeContext) error

type PBKDF2

type PBKDF2 struct {
	HashCommon

	Iterations int    `name:"iterations" help:"Number of iterations to use" default:"10"`
	Digest     string `` /* 142-byte string literal not displayed */
}

func (*PBKDF2) Run

func (p *PBKDF2) Run() error

type Scrypt

type Scrypt struct {
	HashCommon

	Blocksize   int `name:"block-size" help:"Amount of memory to use in kibibytes" default:"8"`
	Cost        int `name:"cost" help:"CPU/memory cost of the scrypt algorithm" default:"16"`
	Parallelism int `name:"parallelism" help:"Degree of parallelism to use" default:"1"`
}

func (*Scrypt) Run

func (s *Scrypt) Run() error

type Server

type Server struct {
	*Base `kong:"-"`

	ListenAddr string `name:"listen-address" help:"Address to listen on" default:":389"`

	Backend struct {
		Name string `name:"name" help:"Backend which stores the data" enum:"yaml" required:"" placeholder:"BACKEND"`
		URL  string `name:"url" help:"URL used to connect to the backend" required:"" placeholder:"URL"`
	} `embed:"" prefix:"backend."`

	TLS struct {
		Enable    bool   `name:"tls" help:"Enable TLS" default:"false" negatable:""`
		MutualTLS bool   `name:"mtls" help:"Enable mutual TLS" default:"false" negatable:""`
		CAFile    []byte `name:"tls.ca" help:"Path to the CA file" optional:"" type:"filecontent" placeholder:"PATH"`
		CertFile  []byte `name:"tls.cert" help:"Path to the certificate file" optional:"" type:"filecontent" placeholder:"PATH"`
		KeyFile   []byte `name:"tls.key" help:"Path to the key file" optional:"" type:"filecontent" placeholder:"PATH"`
	} `embed:""`

	SessionTTL time.Duration `name:"session-ttl" help:"Duration of a BIND session before it expires" default:"168h"`
}

func (Server) NewDirectory

func (s Server) NewDirectory() (directory.Directory, error)

func (Server) Run

func (s Server) Run(_ *kong.Context) error

Run starts the yaLDAP server using the configuration passed to the command.

func (Server) TLSConfig

func (s Server) TLSConfig() (*tls.Config, error)

type Tools

type Tools struct {
	*Base `kong:"-"`

	Hash Hash `cmd:"" help:"Hashing tool"`
}

Jump to

Keyboard shortcuts

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