bosprobe

package
v0.0.0-...-13a05f4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROBE_NOT_CHECK                    = "ProbeNotCheck"
	CODE_SUCCESS                       = "CheckSuccess"
	LOCAL_PROBE_INIT_ERROR             = "ClientProbeInitError"
	LOCAL_ARGS_NO_BUCKET               = "ClientArgsNoBucket"
	LOCAL_ARGS_NO_BUCKET_OR_URL        = "ClientArgsNoBucketOrUrl"
	LOCAL_ARGS_BOTH_URL_OBJECT_EXIST   = "ClientArgsBothUrlObjectExist"
	LOCAL_ARGS_BOTH_URL_BUCKET_EXIST   = "ClientArgsBothUrlBucketExist"
	LOCAL_ARGS_BOTH_URL_ENDPOINT_EXIST = "ClientArgsBothUrlEndpointExist"
	PROBE_INIT_REQUEST_FAILED          = "ProbeInitRequestFailed"
	LOCAL_GENERATETEMPFILE_FAILED      = "ClientGenerateTempFileFailed"
	LOCAL_PROBE_INTERNAL_ERROR         = "ClientProbeInternalError"
	LOCAL_GET_ENDPOINT_BUCKET_FAILED   = "ClientGetEndpointOfBucketFailed"
	LOCAL_PROBE_URL_IS_INVALID         = "ClientProbeUrlIsInvalid"
	SERVER_GET_OBJECT_LIST_DENIED      = "AccessDeniedWhenGetOneObjectName"
	SERVER_RETURN_EMPTY_OBJECT_LIST    = "ServerReturnEmptyObjectList"
)
View Source
const (
	NET_NOT_CHECK_MSG              = "    NET MSG:\t网络畅通!\n"
	ENDPOINT_CONNECT_ERROR_ERR_MSG = "    NET MSG:\t错误代码 2,  不能连接到endpoint (用户能连上" +
		"公网,但不能连接到 endpoint)!\n"
	CLIENT_NET_ERROR_ERR_MSG = "    NET MSG:\t错误代码 3, 用户网络错误 (用户网络既不能连接" +
		"上公网,也不能连接到endpoint)!\n"
)

net error msg

View Source
const (
	ENDPOINT_CONNECT_ERROR_PROMPT = "*您的电脑能够连接到公网,但是连接不上 endpoint,请你检查您" +
		"是否输入了正确的endpoint,如果正确,您可以在百度云的管理控制台创建工单,将BOSProbe生成" +
		"的日志文件反馈给我们,我们会尽快处理!\n"
	CLIENT_NET_ERROR_PROMPT = "我们检测到你的网络即不能连接到公网,也不能连接到endpoint,请您检" +
		"查您的网络是否配置正确,另外还请检查您是否输入了正确的endpoint\n"
)
View Source
const (
	PING_MAX_COUNT           = "5"
	TRACERT_MAX_HOPS         = "15"
	PROBE_NET_INFO_DELIMITER = ">>>>>>"
	PROBE_CHECK_DELIMITER    = "\n\n************************* %s **************************\n"
)
View Source
const (
	PROBE_LOG_FORMAT = "bosprobe%s_%d.log"
	PROBE_LOG_
)
View Source
const (
	DOWNLOAD_CHECK_PROPMT = "下载"
)

Variables

View Source
var (
	DEFAULT_AUTHORITATIVE_ADRESS = "www.baidu.com"
	DEFAULT_ENDPOINT             = "bj.bcebos.com"
	PROBE_AGENT                  = "bce-bos-probe"
)
View Source
var (
	DEFAULT_TMEP_FILE_SIZE = 1 << 20 // 1MB
	COMMON_FILE            = 1
	APPEND_FILE            = 2
	MULTI_PART_FILE        = 3
	UPLOAD_CHECK_PROPMT    = "上传"
)
View Source
var BosProbesuggetions map[BosProbeErrorCode]string

Functions

func Handler

func Handler(c Checker, req ProbeRequest)

the entry of upload test

func NewClient

func NewClient(ak, sk, endpoint string) (*bos.Client, error)

Get a new bos gosdk client

func NewGoSdk

func NewGoSdk(cli bce.Client) goSdk

func PrintDebugInfo

func PrintDebugInfo(resp *serviceResp)

func PrintFailedDetail

func PrintFailedDetail(checkErrorCode BosProbeErrorCode, err error, printToCoTerminal bool)

func PrintLogInfo

func PrintLogInfo()

func PrintNetStatus

func PrintNetStatus(netCode NetStatusCode)

Types

type BosProbeErrorCode

type BosProbeErrorCode string

type Checker

type Checker interface {
	// contains filtered or unexported methods
}

the interface of upload and download checker

type DownloadCheck

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

type DownloadCheckRes

type DownloadCheckRes struct {
	Ak         string
	Sk         string
	FileUrl    string
	BucketName string
	ObjectName string
	LocalPath  string
	Endpoint   string
}

func (*DownloadCheckRes) GetAk

func (d *DownloadCheckRes) GetAk() string

func (*DownloadCheckRes) GetEndPoint

func (d *DownloadCheckRes) GetEndPoint() string

func (*DownloadCheckRes) GetSk

func (d *DownloadCheckRes) GetSk() string

type GoSdkImp

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

func NewGoSdkImp

func NewGoSdkImp(cli bce.Client) *GoSdkImp

type NetStatusCode

type NetStatusCode int
const (
	NET_NOT_CHECK          NetStatusCode = 0
	NET_IS_OK              NetStatusCode = 1
	ENDPOINT_CONNECT_ERROR NetStatusCode = 2
	CLIENT_NET_ERROR       NetStatusCode = 3
)

func NetStatusReport

func NetStatusReport(endpoint, authAddress string) NetStatusCode

get the net status of client

type ProbeRequest

type ProbeRequest interface {
	GetAk() string
	GetSk() string
	GetEndPoint() string
}

the interface of request

type UploadCheck

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

type UploadCheckRes

type UploadCheckRes struct {
	Ak         string
	Sk         string
	BucketName string
	ObjectName string
	LocalPath  string
	Endpoint   string
}

func (*UploadCheckRes) GetAk

func (u *UploadCheckRes) GetAk() string

func (*UploadCheckRes) GetEndPoint

func (u *UploadCheckRes) GetEndPoint() string

func (*UploadCheckRes) GetSk

func (u *UploadCheckRes) GetSk() string

Jump to

Keyboard shortcuts

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