matrix

package
v0.0.0-...-4a512e1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: ISC Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoExist = errors.New("requested resource does not exist")
	Err404     = errors.New("404 while getting registration") // nolint:errname // It is, you're just bad.
)

Errors returned from various bits of machinery

Functions

This section is empty.

Types

type RegisterResult

type RegisterResult struct {
	Session string `json:"session"`
	Flows   []struct {
		Stages []string `json:"stages"`
	} `json:"flows"`

	Error     string `json:"error"`
	ErrorCode string `json:"errcode"`
}

RegisterResult is the json blob returned from the registration endpoint

func (*RegisterResult) AllowsUnverifiedRegistration

func (r *RegisterResult) AllowsUnverifiedRegistration(badflows []*set.StringSet) bool

AllowsUnverifiedRegistration returns whether or not this result allows for unverified registration based on the passed list of bad flow sets

type ScanResult

type ScanResult struct {
	*RegisterResult
	Homeserver   string
	Delegate     string
	DelegateType string
	Remarks      []string
}

ScanResult represents the result of a scan made using Scanner. Remarks may contain interesting (to a human) messages regarding the process

type Scanner

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

Scanner provides a frontend to scan matrix servers for bad behaviour

func NewScanner

func NewScanner(logger *logging.Logger, cacheTimeout time.Duration) *Scanner

NewScanner creates a new matrix scanner with the given logger

func (*Scanner) GetServerDelegate

func (m *Scanner) GetServerDelegate(ctx context.Context, server string) (
	delegate string, delegateType string, err error,
)

GetServerDelegate returns the "real" host for a given homeserver

func (*Scanner) ScanServer

func (m *Scanner) ScanServer(ctx context.Context, server string, badFlows []*set.StringSet) (bool, error)

ScanServer asks the given server for its available flows, and returns whether or not any flow matched badFlows

func (*Scanner) ScanServerResult

func (m *Scanner) ScanServerResult(ctx context.Context, server string) (*ScanResult, error)

ScanServerResult returns a ScanResult for a given server scan, or an Error

Jump to

Keyboard shortcuts

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