mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 03:43:11 -06:00
25 lines
486 B
Go
25 lines
486 B
Go
package basecomponent
|
|
|
|
import (
|
|
"errors"
|
|
|
|
pstore "github.com/libp2p/go-libp2p-core/peerstore"
|
|
record "github.com/libp2p/go-libp2p-record"
|
|
)
|
|
|
|
type LibP2PValidator struct {
|
|
KeyBook pstore.KeyBook
|
|
}
|
|
|
|
func (v LibP2PValidator) Validate(key string, value []byte) error {
|
|
ns, _, err := record.SplitKey(key)
|
|
if err != nil || ns != "matrix" {
|
|
return errors.New("not Matrix path")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (v LibP2PValidator) Select(k string, vals [][]byte) (int, error) {
|
|
return 0, nil
|
|
}
|