controller

package
v0.0.0-...-86e4c60 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Function tag
	Function = "function"
	//SNID tag
	SNID = "snID"
	//MinerID tag
	MinerID = "minerID"
	//BlockID tag
	BlockID = "blockID"
	//ShardID tag
	ShardID = "shardID"
)
View Source
const (
	Success             = 0
	ReadRequestFailed   = -1
	ReadResponseFailed  = -2
	InvalidParameter    = -3
	SignFailed          = -4
	VerifyFailed        = -5
	JsonMarshalFailed   = -6
	CreateRequestFailed = -7
	ServerProcessFailed = -8
	SendTrx1Failed      = -10
	SendTrx2Failed      = -11
)
View Source
const AUTH_FAILURE = 0x55

Variables

This section is empty.

Functions

func AddClientforMobile

func AddClientforMobile(g *gin.Context)

func AddPubkey

func AddPubkey(g *gin.Context)

func CreateAccountCli

func CreateAccountCli(g *gin.Context)

func CreateBucket

func CreateBucket(g *gin.Context)

CreateBucket 创建bucket

func DownloadFile

func DownloadFile(g *gin.Context)

DownloadFile 下载

func DownloadFileForSGX

func DownloadFileForSGX(g *gin.Context)

func ExporterAuthData

func ExporterAuthData(g *gin.Context)

ExporterAuthData 导出授权文件证书,byte类型

func ExporterAuthData(g *gin.Context) {
	bucketName := g.Query("bucketName")
	fileName := g.Query("fileName")
	ownerPublic := g.Query("ownerPublic")
	otherPublicKey := g.Query("otherPublicKey")
	content := ownerPublic[3:]
	c := api.GetClient(content)
	exporter, yerr := c.ExporterAuth(bucketName, fileName)
	if yerr != nil {
		logrus.Panicf("初始化授权导出失败:%s\n", yerr.Msg)
	}
	newOtherPublicKey := otherPublicKey[3:]
	authdata, yerr := exporter.Export(newOtherPublicKey)
	if yerr != nil {
		logrus.Panicf("导出授权文件失败:%s\n", yerr.Msg)
	}
	g.JSON(http.StatusOK, gin.H{"authdata": authdata})
}

func GetDownloadProgress

func GetDownloadProgress(g *gin.Context)

GetDownloadProgress 查询上传进度

func GetFileAllInfo

func GetFileAllInfo(g *gin.Context)

GetFileAllInfo 获取文件详细信息

func GetFileBlockDetails

func GetFileBlockDetails(g *gin.Context)

GetFileBlockDetails 查询文件分块信息

func GetObjects

func GetObjects(g *gin.Context)

GetObjects 获取文件列表

func GetProgramVersion

func GetProgramVersion(g *gin.Context)

func GetProgress

func GetProgress(g *gin.Context)
	g.String(http.StatusOK, strconv.FormatInt(int64(ii), 10))
}

func GetRandomString2

func GetRandomString2(n int) string

func Importclient

func Importclient(userName, privateKey string) (*api.Client, error)

Importclient 2.注册导入授权的用户实例

func ImporterAuth

func ImporterAuth(g *gin.Context)

ImporterAuth 导入授权文件

func LicensedTo

func LicensedTo(g *gin.Context)

func ListBucket

func ListBucket(g *gin.Context)

ListBucket list all bucket

func Login

func Login(g *gin.Context)

func Register

func Register(g *gin.Context)

Register 用户注册

func SaveFileToLocal

func SaveFileToLocal(g *gin.Context)

func UploadFile

func UploadFile(g *gin.Context)

UploadFile 根据路径上传文件

func UploadForAuth

func UploadForAuth(g *gin.Context)

UploadForAuth 3.通过上传接口,给导出授权的用户上传一个文件

Types

type AccClient

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

func NewClient

func NewClient(serverURL string) *AccClient

NewClient create new client instance

type Auth

type Auth struct {
	BucketName  string `form:"bucketName" json:"bucketName" binding:"required"`
	FileName    string `form:"fileName" json:"fileName" xml:"fileName" binding:"required"`
	OwnerPublic string `form:"ownerPublic" json:"ownerPublic" xml:"ownerPublic" binding:"required"`
	AuthPath    string `form:"path" json:"path" binding:"required"`
}

type Block

type Block struct {
	BlockNum     string //分块编号
	BlockEncPath string //16进制加密
	BlockSrcPath string //16进制非加密
	BlockZipPath string
	Shards       []*Shard
}

Block 块信息

type Bucket

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

type CreateParam

type CreateParam struct {
	AccountPubKey string `json:"accountPubKey"`
	StoragePubKey string `json:"storagePubKey"`
	Signature     string `json:"signature"`
}

type CreateRespCli

type CreateRespCli struct {
	AccountName string `json:"accountName"`
	OwnerPK     string `json:"ownerPK"`
	OwnerSK     string `json:"ownerSK"`
	StoragePK   string `json:"storagePK"`
	StorageSK   string `json:"storageSK"`
}

type FileBlockAndShardInfo

type FileBlockAndShardInfo struct {
	FileName   string //文件名
	FileLength int64
	BlockCount int //文件总块数量
	Blocks     []*Block
}

FileBlockAndShardInfo 文件信息

type ObjectItem

type ObjectItem struct {
	FileName   string
	FileLength string
	TimeStamp  string
	// contains filtered or unexported fields
}

type Response

type Response struct {
	Code        int    `json:"code"`
	Msg         string `json:"msg"`
	AccountName string `json:"accountName"`
}

type ResponseCli

type ResponseCli struct {
	Code int            `json:"code"`
	Msg  string         `json:"msg"`
	Data *CreateRespCli `json:"data"`
}

func CreateResponseCli

func CreateResponseCli(code int, err error, data *CreateRespCli) *ResponseCli

type Shard

type Shard struct {
	ShardID      int
	ShardSrcPath string //分片16进制数据
}

Shard 分片信息

type User

type User struct {
	UserName   string `form:"userName" json:"userName" binding:"required"`
	PrivateKey string `form:"privateKey" json:"privateKey" xml:"privateKey" binding:"required"`
}

User 用户注册

Jump to

Keyboard shortcuts

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