Documentation ¶
Index ¶
- Constants
- type DNSService
- type Error
- type Handler
- func (h *Handler) AcceptFriend(c echo.Context) (err error)
- func (h *Handler) Address() string
- func (h *Handler) ExportServerConfiguration(c echo.Context) (err error)
- func (h *Handler) GetAuthRequests(c echo.Context) (err error)
- func (h *Handler) GetBlockedPeers(c echo.Context) (err error)
- func (h *Handler) GetKnownPeerSettings(c echo.Context) (err error)
- func (h *Handler) GetKnownPeers(c echo.Context) (err error)
- func (h *Handler) GetLog(c echo.Context) (err error)
- func (h *Handler) GetMyPeerInfo(c echo.Context) (err error)
- func (h *Handler) GetP2pDebugInfo(c echo.Context) (err error)
- func (h *Handler) RemovePeer(c echo.Context) (err error)
- func (h *Handler) SendFriendRequest(c echo.Context) (err error)
- func (h *Handler) SetupAPI() error
- func (h *Handler) SetupFrontend(fsys fs.FS)
- func (h *Handler) Shutdown(ctx context.Context) error
- func (h *Handler) UpdateMySettings(c echo.Context) (err error)
- func (h *Handler) UpdatePeerSettings(c echo.Context) (err error)
Constants ¶
const ( V0Prefix = "/api/v0/" // Peers GetKnownPeersPath = V0Prefix + "peers/get_known" GetKnownPeerSettingsPath = V0Prefix + "peers/get_known_peer_settings" UpdatePeerSettingsPath = V0Prefix + "peers/update_settings" RemovePeerSettingsPath = V0Prefix + "peers/remove" GetBlockedPeersPath = V0Prefix + "peers/get_blocked" SendFriendRequestPath = V0Prefix + "peers/invite_peer" AcceptPeerInvitationPath = V0Prefix + "peers/accept_peer" GetAuthRequestsPath = V0Prefix + "peers/auth_requests" // Settings GetMyPeerInfoPath = V0Prefix + "settings/peer_info" UpdateMyInfoPath = V0Prefix + "settings/update" ExportServerConfigPath = V0Prefix + "settings/export_server_config" // Debug GetP2pDebugInfoPath = V0Prefix + "debug/p2p_info" GetDebugLogPath = V0Prefix + "debug/log" )
const ErrorPeerAliasIsNotUniq = "peer name is not unique"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DNSService ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(conf *config.Config, p2p *p2p.P2p, authStatus *service.AuthStatus, tunnel *service.Tunnel, logBuffer *ringbuffer.RingBuffer, dns DNSService) *Handler
func (*Handler) AcceptFriend ¶
@Tags Peers @Summary Accept new peer's invitation @Accept json @Produce json @Param body body entity.FriendRequestReply true "Params" @Success 200 "OK" @Failure 400 {object} api.Error @Failure 500 {object} api.Error @Router /peers/accept_peer [POST]
func (*Handler) ExportServerConfiguration ¶
@Tags Settings @Summary Export server configuration @Accept json @Produce json @Success 200 {object} config.Config @Router /settings/export_server_config [GET]
func (*Handler) GetAuthRequests ¶
@Tags Peers @Summary Get ingoing auth requests @Accept json @Produce json @Success 200 {array} entity.AuthRequest @Router /peers/auth_requests [GET]
func (*Handler) GetBlockedPeers ¶
@Tags Peers @Summary Get blocked peers info @Accept json @Produce json @Success 200 {array} config.BlockedPeer @Router /peers/get_blocked [GET]
func (*Handler) GetKnownPeerSettings ¶
@Tags Peers @Summary Get known peer settings @Accept json @Produce json @Param body body entity.PeerIDRequest true "Params" @Success 200 {object} config.KnownPeer @Failure 400 {object} api.Error @Failure 404 {object} api.Error @Router /peers/get_known_peer_settings [POST]
func (*Handler) GetKnownPeers ¶
@Tags Peers @Summary Get known peers info @Accept json @Produce json @Success 200 {array} entity.KnownPeersResponse @Router /peers/get_known [GET]
func (*Handler) GetLog ¶
@Tags Debug @Summary Get logs @Param logs query int false "Define number of rows of logs to output. On default and 0 prints all." @Param from_head query bool false "Print logs from the beginning of logs" @Produce plain @Success 200 {string} string "log text" @Router /debug/log [GET]
func (*Handler) GetMyPeerInfo ¶
@Tags Settings @Summary Get my peer info @Accept json @Produce json @Success 200 {object} entity.PeerInfo @Router /settings/peer_info [GET]
func (*Handler) GetP2pDebugInfo ¶
@Tags Debug @Summary Get p2p debug info @Produce json @Success 200 {object} entity.P2pDebugInfo @Router /debug/p2p_info [GET]
func (*Handler) RemovePeer ¶
@Tags Peers @Summary Remove known peer @Accept json @Produce json @Param body body entity.PeerIDRequest true "Params" @Success 200 "OK" @Failure 400 {object} api.Error @Failure 404 {object} api.Error @Router /peers/remove [POST]
func (*Handler) SendFriendRequest ¶
@Tags Peers @Summary Invite new peer @Accept json @Produce json @Param body body entity.FriendRequest true "Params" @Success 200 "OK" @Failure 400 {object} api.Error @Failure 500 {object} api.Error @Router /peers/invite_peer [POST]
func (*Handler) SetupFrontend ¶
func (*Handler) UpdateMySettings ¶
@Tags Settings @Summary Update my peer info @Accept json @Produce json @Param body body entity.UpdateMySettingsRequest true "Params" @Success 200 "OK" @Router /settings/update [POST]
func (*Handler) UpdatePeerSettings ¶
@Tags Peers @Summary Update peer settings @Accept json @Produce json @Param body body entity.UpdatePeerSettingsRequest true "Params" @Success 200 "OK" @Failure 400 {object} api.Error @Failure 404 {object} api.Error @Router /peers/update_settings [POST]