Documentation
¶
Index ¶
- Constants
- Variables
- func AppVersionMiddleware(appVersion string) echo.MiddlewareFunc
- func CalculateCarSize(data cid.Cid, objects []CarObject) (uint64, error)
- func CanRestartTransfer(st *filclient.ChannelState) bool
- func CidIsUnwalkable(c cid.Cid) bool
- func CreateRetrievalURL(cid string) string
- func DirsFromPath(collectionPath string, filename string) ([]string, error)
- func EnsurePathIsLinked(dirs []string, rootNode *merkledag.ProtoNode, ds format.DAGService) (*merkledag.ProtoNode, error)
- func ErrorHandler(err error, ctx echo.Context)
- func ErrorIfContentAddingDisabled(isContentAddingDisabled bool) error
- func ExtractAuth(c echo.Context) (string, error)
- func FilterUnwalkableLinks(links []*ipld.Link) []*ipld.Link
- func GetPasswordHash(password, salt string, dialector string) string
- func GetPasswordHashBase(password, salt string) string
- func GetPasswordHashBase64(password, salt string) string
- func GetTokenHash(token string) string
- func ImportFile(dserv ipld.DAGService, fi io.Reader) (ipld.Node, error)
- func IsCollectionOwner(uID, entityID uint) error
- func IsContentOwner(uID, entityID uint) error
- func JSONPayloadMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func ParseDealLabel(s string) (cid.Cid, error)
- func SetupDatabase(dbval string) (*gorm.DB, error)
- func TransferFailed(st *filclient.ChannelState) (bool, string)
- func TryExtractFSNode(nd ipld.Node) (*unixfs.FSNode, error)
- func WithContentLengthCheck(f func(echo.Context) error) func(echo.Context) error
- type AuthToken
- type Binder
- type CarObject
- type ChanTrack
- type Content
- type ContentAddIpfsBody
- type ContentAddResponse
- type ContentCreateBody
- type ContentCreateResponse
- type ContentInCollection
- type ContentType
- type ContentWithPath
- type DbAddr
- type DbCID
- type GenericResponse
- type HttpError
- type HttpErrorResponse
- type InitShuttleResponse
- type InviteCode
- type ObjRef
- type Object
- type PeeringPeerAddMessage
- type PeeringPeerRemoveMessage
- type RetrievalFailureRecord
- type RetrievalProgress
- type ShuttleCreateContentBody
- type ShuttleListResponse
- type ShuttleStorageStats
- type User
- type UserSettings
- type ViewerResponse
Constants ¶
View Source
const ( ERR_INVALID_TOKEN = "ERR_INVALID_TOKEN" ERR_TOKEN_EXPIRED = "ERR_TOKEN_EXPIRED" ERR_AUTH_MISSING = "ERR_AUTH_MISSING" ERR_WRONG_AUTH_FORMAT = "ERR_WRONG_AUTH_FORMAT" ERR_INVALID_AUTH = "ERR_INVALID_AUTH" ERR_AUTH_MISSING_BEARER = "ERR_AUTH_MISSING_BEARER" ERR_NOT_AUTHORIZED = "ERR_NOT_AUTHORIZED" ERR_MINER_NOT_OWNED = "ERR_MINER_NOT_OWNED" ERR_INVALID_INVITE = "ERR_INVALID_INVITE" ERR_USERNAME_TAKEN = "ERR_USERNAME_TAKEN" ERR_USER_CREATION_FAILED = "ERR_USER_CREATION_FAILED" ERR_USER_NOT_FOUND = "ERR_USER_NOT_FOUND" ERR_INVALID_PASSWORD = "ERR_INVALID_PASSWORD" ERR_INVALID_FILTER = "ERR_INVALID_FILTER" ERR_INVITE_ALREADY_USED = "ERR_INVITE_ALREADY_USED" ERR_CONTENT_ADDING_DISABLED = "ERR_CONTENT_ADDING_DISABLED" ERR_INVALID_INPUT = "ERR_INVALID_INPUT" ERR_CONTENT_SIZE_OVER_LIMIT = "ERR_CONTENT_SIZE_OVER_LIMIT" ERR_PEERING_PEERS_ADD_ERROR = "ERR_PEERING_PEERS_ADD_ERROR" ERR_PEERING_PEERS_REMOVE_ERROR = "ERR_PEERING_PEERS_REMOVE_ERROR" ERR_PEERING_PEERS_START_ERROR = "ERR_PEERING_PEERS_START_ERROR" ERR_PEERING_PEERS_STOP_ERROR = "ERR_PEERING_PEERS_STOP_ERROR" ERR_CONTENT_NOT_FOUND = "ERR_CONTENT_NOT_FOUND" ERR_RECORD_NOT_FOUND = "ERR_RECORD_NOT_FOUND" ERR_INVALID_PINNING_STATUS = "ERR_INVALID_PINNING_STATUS" ERR_INVALID_QUERY_PARAM_VALUE = "ERR_INVALID_QUERY_PARAM_VALUE" ERR_CONTENT_LENGTH_REQUIRED = "ERR_CONTENT_LENGTH_REQUIRED" ERR_UNSUPPORTED_CONTENT_TYPE = "ERR_UNSUPPORTED_CONTENT_TYPE" ERR_VALUE_REQUIRED = "ERR_VALUE_REQUIRED" )
#nosec G101 -- This is a false positive
View Source
const ( ERR_AUTH_MISSING_DETAILS = "no api key was specified" ERR_AUTH_MISSING_BEARER_DETAILS = "" //#nosec G101 -- This is a false positive and example API KEY /* 186-byte string literal not displayed */ ERR_INVALID_AUTH_DETAILS = "" //#nosec G101 -- This is a false positive and example API KEY /* 236-byte string literal not displayed */ )
View Source
const ( PermLevelUpload = 1 PermLevelUser = 2 PermLevelAdmin = 10 )
Variables ¶
View Source
var DefaultHashFunction = uint64(mh.SHA2_256)
View Source
var FlagLogLevel = &cli.StringFlag{ Name: "log-level", Usage: "sets the log level, defaults to INFO", Value: "INFO", Destination: &LogLevel, }
View Source
var LogLevel string
Functions ¶
func AppVersionMiddleware ¶
func AppVersionMiddleware(appVersion string) echo.MiddlewareFunc
func CanRestartTransfer ¶ added in v0.1.9
func CanRestartTransfer(st *filclient.ChannelState) bool
func CidIsUnwalkable ¶
func CreateRetrievalURL ¶ added in v0.1.8
func DirsFromPath ¶
DirsFromPath splits a path into a list of directories
func EnsurePathIsLinked ¶
func ErrorHandler ¶
func ErrorIfContentAddingDisabled ¶ added in v0.1.5
func GetPasswordHash ¶ added in v0.1.8
func GetPasswordHashBase ¶ added in v0.1.10
func GetPasswordHashBase64 ¶ added in v0.1.10
func GetTokenHash ¶ added in v0.1.11
func ImportFile ¶
func IsCollectionOwner ¶ added in v0.1.4
func IsContentOwner ¶ added in v0.1.4
func JSONPayloadMiddleware ¶ added in v0.1.10
func JSONPayloadMiddleware(next echo.HandlerFunc) echo.HandlerFunc
func TransferFailed ¶ added in v0.1.9
func TransferFailed(st *filclient.ChannelState) (bool, string)
Types ¶
type ChanTrack ¶
type ChanTrack struct {
Dbid uint
Last *filclient.ChannelState
}
type Content ¶ added in v0.1.8
type Content struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
Cid DbCID `json:"cid"`
Name string `json:"name"`
UserID uint `json:"userId" gorm:"index"`
Description string `json:"description"`
Size int64 `json:"size"`
Type ContentType `json:"type"`
Active bool `json:"active"`
Offloaded bool `json:"offloaded"`
Replication int `json:"replication"`
// TODO: shift most of the 'state' booleans in here into a single state
// field, should make reasoning about things much simpler
AggregatedIn uint `json:"aggregatedIn" gorm:"index:,option:CONCURRENTLY"`
Aggregate bool `json:"aggregate"`
Pinning bool `json:"pinning"`
PinMeta string `json:"pinMeta"`
Replace bool `json:"replace" gorm:"default:0"`
Origins string `json:"origins"`
Failed bool `json:"failed"`
Location string `json:"location"`
// If set, this content is part of a split dag.
// In such a case, the 'root' content should be advertised on the dht, but
// not have deals made for it, and the children should have deals made for
// them (unlike with aggregates)
DagSplit bool `json:"dagSplit"`
SplitFrom uint `json:"splitFrom"`
}
type ContentAddIpfsBody ¶
type ContentAddIpfsBody struct {
ContentInCollection
Root string `json:"root"`
Name string `json:"filename"`
Peers []string `json:"peers"`
}
type ContentAddResponse ¶
type ContentCreateBody ¶
type ContentCreateBody struct {
ContentInCollection
Root string `json:"root"`
Name string `json:"name"`
Location string `json:"location"`
Type ContentType `json:"type"`
}
type ContentCreateResponse ¶
type ContentCreateResponse struct {
ID uint `json:"id"`
}
type ContentInCollection ¶
type ContentType ¶
type ContentType int64
const ( Unknown ContentType = iota File Directory )
func FindCIDType ¶
func FindCIDType(ctx context.Context, root cid.Cid, dserv ipld.NodeGetter) (contentType ContentType)
FindCIDType checks if a pinned CID (root) is a file, a dir or unknown Returns dbmgr.File or dbmgr.Directory on success Returns dbmgr.Unknown otherwise
type ContentWithPath ¶ added in v0.1.8
type GenericResponse ¶ added in v0.1.1
type GenericResponse struct {
Message string `json:"message"`
}
generic response models
type HttpError ¶
type HttpErrorResponse ¶ added in v0.1.1
type HttpErrorResponse struct {
Error HttpError `json:"error"`
}
type InitShuttleResponse ¶
type InviteCode ¶ added in v0.1.10
type PeeringPeerAddMessage ¶ added in v0.1.1
type PeeringPeerAddMessage struct {
Message string `json:"message"`
PeersAdd []peering.PeeringPeer `json:"peers"`
}
type PeeringPeerRemoveMessage ¶ added in v0.1.1
type RetrievalFailureRecord ¶
type RetrievalProgress ¶
type RetrievalProgress struct {
Wait chan struct{}
EndErr error
}
type ShuttleCreateContentBody ¶
type ShuttleCreateContentBody struct {
ContentCreateBody
Collections []string `json:"collections"`
DagSplitRoot uint `json:"dagSplitRoot"`
User uint `json:"user"`
}
type ShuttleListResponse ¶
type ShuttleListResponse struct {
Handle string `json:"handle"`
Token string `json:"token"`
Online bool `json:"online"`
LastConnection time.Time `json:"lastConnection"`
AddrInfo *peer.AddrInfo `json:"addrInfo"`
Address address.Address `json:"address"`
Hostname string `json:"hostname"`
StorageStats *ShuttleStorageStats `json:"storageStats"`
}
type ShuttleStorageStats ¶
type User ¶ added in v0.1.10
type User struct {
gorm.Model
UUID string `gorm:"unique"`
Username string `gorm:"unique"`
Salt string
PassHash string
DID string
UserEmail string
Address DbAddr
AuthToken AuthToken `gorm:"-"`
Perm int
Flags int
StorageDisabled bool
}
func (*User) FlagSplitContent ¶ added in v0.1.10
type UserSettings ¶
type UserSettings struct {
Replication int `json:"replication"`
Verified bool `json:"verified"`
DealDuration abi.ChainEpoch `json:"dealDuration"`
MaxStagingWait time.Duration `json:"maxStagingWait"`
FileStagingThreshold int64 `json:"fileStagingThreshold"`
ContentAddingDisabled bool `json:"contentAddingDisabled"`
DealMakingDisabled bool `json:"dealMakingDisabled"`
UploadEndpoints []string `json:"uploadEndpoints"`
Flags int `json:"flags"`
}
type ViewerResponse ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.