libstns

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 22 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRetry = 3
View Source
var DefaultTimeout = 15

Functions

func DefaultMakeChallengeCode

func DefaultMakeChallengeCode() ([]byte, error)

func DefaultPopChallengeCode

func DefaultPopChallengeCode(user string) ([]byte, error)

func DefaultStoreChallengeCode

func DefaultStoreChallengeCode(user string, code []byte) error

Types

type Options

type Options struct {
	AuthToken          string `env:"STNS_AUTH_TOKEN"`
	User               string `env:"STNS_USER"`
	Password           string `env:"STNS_PASSWORD"`
	UserAgent          string
	SkipSSLVerify      bool `env:"STNS_SKIP_VERIFY"`
	HttpProxy          string
	HttpKeepalive      bool `env:"STNS_HTTP_KEEPALIVE"`
	RequestTimeout     int  `env:"STNS_REQUEST_TIMEOUT"`
	RequestRetry       int  `env:"STNS_REQUEST_RETRY"`
	HttpHeaders        map[string]string
	TLS                TLS
	PrivatekeyPath     string `env:"STNS_PRIVATE_KEY"`
	PrivatekeyPassword string `env:"STNS_PRIVATE_KEY_PASSWORD"`
}

type Response

type Response struct {
	StatusCode int
	Headers    map[string]string
	Body       []byte
}

type STNS

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

func NewSTNS

func NewSTNS(endpoint string, opt *Options) (*STNS, error)

func (*STNS) CreateUserChallengeCode

func (c *STNS) CreateUserChallengeCode(name string) ([]byte, error)

func (*STNS) GetGroupByID

func (s *STNS) GetGroupByID(id int) (*model.Group, error)

func (*STNS) GetGroupByName

func (s *STNS) GetGroupByName(name string) (*model.Group, error)

func (*STNS) GetUserByID

func (s *STNS) GetUserByID(id int) (*model.User, error)

func (*STNS) GetUserByName

func (s *STNS) GetUserByName(name string) (*model.User, error)

func (*STNS) ListGroup

func (s *STNS) ListGroup() ([]*model.Group, error)

func (*STNS) ListUser

func (s *STNS) ListUser() ([]*model.User, error)

func (*STNS) PopUserChallengeCode

func (c *STNS) PopUserChallengeCode(name string) ([]byte, error)

func (*STNS) Request

func (s *STNS) Request(path, query string) (*Response, error)

func (*STNS) SetPopChallengeCode

func (s *STNS) SetPopChallengeCode(f func(string) ([]byte, error))

func (*STNS) SetStoreChallengeCode

func (s *STNS) SetStoreChallengeCode(f func(string, []byte) error)

func (*STNS) Sign

func (c *STNS) Sign(code []byte) ([]byte, error)

func (*STNS) Verify

func (c *STNS) Verify(msg, publicKeyBytes, signature []byte) error

func (*STNS) VerifyWithUser

func (c *STNS) VerifyWithUser(name string, msg, signature []byte) error

type TLS

type TLS struct {
	CA   string
	Cert string
	Key  string
}

Jump to

Keyboard shortcuts

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