add more godoc strings
This commit is contained in:
@ -1,20 +0,0 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
package alias
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb"
|
|
||||||
|
|
||||||
kitlog "github.com/go-kit/kit/log"
|
|
||||||
|
|
||||||
refs "go.mindeco.de/ssb-refs"
|
|
||||||
)
|
|
||||||
|
|
||||||
func New(log kitlog.Logger, self refs.FeedRef, aliasDB roomdb.AliasService) Handler {
|
|
||||||
var h Handler
|
|
||||||
h.self = self
|
|
||||||
h.logger = log
|
|
||||||
h.db = aliasDB
|
|
||||||
|
|
||||||
return h
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
// Package alias implements the muxrpc handlers for alias needs.
|
||||||
package alias
|
package alias
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -18,6 +19,7 @@ import (
|
|||||||
refs "go.mindeco.de/ssb-refs"
|
refs "go.mindeco.de/ssb-refs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Handler implements the muxrpc methods for alias registration and recvocation
|
||||||
type Handler struct {
|
type Handler struct {
|
||||||
logger kitlog.Logger
|
logger kitlog.Logger
|
||||||
self refs.FeedRef
|
self refs.FeedRef
|
||||||
@ -25,8 +27,22 @@ type Handler struct {
|
|||||||
db roomdb.AliasService
|
db roomdb.AliasService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New returns a fresh alias muxrpc handler
|
||||||
|
func New(log kitlog.Logger, self refs.FeedRef, aliasDB roomdb.AliasService) Handler {
|
||||||
|
var h Handler
|
||||||
|
h.self = self
|
||||||
|
h.logger = log
|
||||||
|
h.db = aliasDB
|
||||||
|
|
||||||
|
return h
|
||||||
|
}
|
||||||
|
|
||||||
const sigSuffix = ".sig.ed25519"
|
const sigSuffix = ".sig.ed25519"
|
||||||
|
|
||||||
|
// Register is an async muxrpc method handler for registering aliases.
|
||||||
|
// It receives two string arguments over muxrpc (alias and signature),
|
||||||
|
// checks the signature confirmation is correct (for this room and signed by the key of theconnection)
|
||||||
|
// If it is valid, it registers the alias on the roomdb and returns true. If not it returns an error.
|
||||||
func (h Handler) Register(ctx context.Context, req *muxrpc.Request) (interface{}, error) {
|
func (h Handler) Register(ctx context.Context, req *muxrpc.Request) (interface{}, error) {
|
||||||
var args []string
|
var args []string
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/ssb-ngi-pointer/go-ssb-room/muxrpc/handlers/whoami"
|
"github.com/ssb-ngi-pointer/go-ssb-room/muxrpc/handlers/whoami"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// instantiate and register the muxrpc handlers
|
||||||
func (s *Server) initHandlers(aliasDB roomdb.AliasService) {
|
func (s *Server) initHandlers(aliasDB roomdb.AliasService) {
|
||||||
// inistaniate handler packages
|
// inistaniate handler packages
|
||||||
whoami := whoami.New(s.Whoami())
|
whoami := whoami.New(s.Whoami())
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/ssb-ngi-pointer/go-ssb-room/internal/network"
|
"github.com/ssb-ngi-pointer/go-ssb-room/internal/network"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// opens the shs listener for TCP connections
|
||||||
func (s *Server) initNetwork() error {
|
func (s *Server) initNetwork() error {
|
||||||
// muxrpc handler creation and authoratization decider
|
// muxrpc handler creation and authoratization decider
|
||||||
mkHandler := func(conn net.Conn) (muxrpc.Handler, error) {
|
mkHandler := func(conn net.Conn) (muxrpc.Handler, error) {
|
||||||
|
@ -25,6 +25,7 @@ func WithUNIXSocket(yes bool) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// creates the UNIX socket file listener for local usage
|
||||||
func (s *Server) initUnixSock() error {
|
func (s *Server) initUnixSock() error {
|
||||||
// this races because roomsrv might not be done with init yet
|
// this races because roomsrv might not be done with init yet
|
||||||
// TODO: refactor network peer code and make unixsock implement that (those will be inited late anyway)
|
// TODO: refactor network peer code and make unixsock implement that (those will be inited late anyway)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
// Package roomsrv implements the muxrpc server for all the room related code.
|
||||||
|
// It ties the muxrpc/handlers packages and network listeners together.
|
||||||
package roomsrv
|
package roomsrv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -15,6 +15,8 @@ import (
|
|||||||
weberrors "github.com/ssb-ngi-pointer/go-ssb-room/web/errors"
|
weberrors "github.com/ssb-ngi-pointer/go-ssb-room/web/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// aliasesHandler implements the managment endpoints for aliases (list and revoke),
|
||||||
|
// does light validation of the web arguments and passes them through to the roomdb.
|
||||||
type aliasesHandler struct {
|
type aliasesHandler struct {
|
||||||
r *render.Renderer
|
r *render.Renderer
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
// Package admin implements the dashboard for admins and moderators to change and control aspects of the room.
|
||||||
|
// Including aliases, allow/deny list managment, invites and settings of the room.
|
||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -18,6 +20,7 @@ import (
|
|||||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomstate"
|
"github.com/ssb-ngi-pointer/go-ssb-room/roomstate"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// HTMLTemplates define the list of files the template system should load.
|
||||||
var HTMLTemplates = []string{
|
var HTMLTemplates = []string{
|
||||||
"admin/dashboard.tmpl",
|
"admin/dashboard.tmpl",
|
||||||
"admin/menu.tmpl",
|
"admin/menu.tmpl",
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb"
|
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// aliasHandler implements the public resolve endpoint for HTML and JSON requests.
|
||||||
type aliasHandler struct {
|
type aliasHandler struct {
|
||||||
r *render.Renderer
|
r *render.Renderer
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user