- update json

master v1.0.102
李光春 1 year ago
parent 192facfdf0
commit f21a47699e

@ -1,3 +1,7 @@
## v1.0.102
- update [json](utils%2Fgojson%2Fjson)
## v1.0.101
- update [goip](utils%2Fgoip)

@ -4,15 +4,18 @@ go 1.20
require (
github.com/MercuryEngineering/CookieMonster v0.0.0-20180304172713-1584578b3403
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
github.com/allegro/bigcache/v3 v3.1.0
github.com/baidubce/bce-sdk-go v0.9.146
github.com/basgys/goxml2json v1.1.0
github.com/bytedance/sonic v1.8.6
github.com/gin-gonic/gin v1.9.0
github.com/go-playground/locales v0.14.1
github.com/go-playground/universal-translator v0.18.1
github.com/go-playground/validator/v10 v10.12.0
github.com/go-sql-driver/mysql v1.7.0
github.com/goccy/go-json v0.10.2
github.com/json-iterator/go v1.1.12
github.com/lib/pq v1.10.7
github.com/mitchellh/mapstructure v1.5.0
github.com/mvdan/xurls v1.1.0
@ -40,14 +43,12 @@ require (
require (
github.com/bitly/go-simplejson v0.5.0 // indirect
github.com/bytedance/sonic v1.8.6 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/clbanning/mxj v1.8.4 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
@ -55,7 +56,6 @@ require (
github.com/jackc/pgx/v5 v5.3.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.3 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.2 // indirect

@ -18,8 +18,8 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible h1:KXeJoM1wo9I/6xPTyt6qCxoSZnmASiAjlrr0dyTUKt8=
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible h1:KpbJFXwhVeuxNtBJ74MCGbIoaBok2uZvkD7QXp2+Wis=
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk=
github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=

@ -1,5 +1,5 @@
package go_library
func Version() string {
return "1.0.101"
return "1.0.102"
}

@ -1,6 +1,6 @@
package gojson
import "encoding/json"
import "github.com/dtapps/go-library/utils/gojson/json"
func Encode(v interface{}) (string, error) {
bytes, err := json.Marshal(v)

@ -0,0 +1,23 @@
// Copyright 2017 Bo-Yi Wu. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
//go:build go_json
// +build go_json
package json
import json "github.com/goccy/go-json"
var (
// Marshal is exported by gojson/json package.
Marshal = json.Marshal
// Unmarshal is exported by gojson/json package.
Unmarshal = json.Unmarshal
// MarshalIndent is exported by gojson/json package.
MarshalIndent = json.MarshalIndent
// NewDecoder is exported by gojson/json package.
NewDecoder = json.NewDecoder
// NewEncoder is exported by gojson/json package.
NewEncoder = json.NewEncoder
)

@ -0,0 +1,25 @@
// Copyright 2017 Bo-Yi Wu. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
//go:build !jsoniter && !go_json && !(sonic && avx && (linux || windows || darwin) && amd64)
// +build !jsoniter
// +build !go_json
// +build !sonic !avx !linux,!windows,!darwin !amd64
package json
import "encoding/json"
var (
// Marshal is exported by gojson/json package.
Marshal = json.Marshal
// Unmarshal is exported by gojson/json package.
Unmarshal = json.Unmarshal
// MarshalIndent is exported by gojson/json package.
MarshalIndent = json.MarshalIndent
// NewDecoder is exported by gojson/json package.
NewDecoder = json.NewDecoder
// NewEncoder is exported by gojson/json package.
NewEncoder = json.NewEncoder
)

@ -0,0 +1,24 @@
// Copyright 2017 Bo-Yi Wu. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
//go:build jsoniter
// +build jsoniter
package json
import jsoniter "github.com/json-iterator/go"
var (
json = jsoniter.ConfigCompatibleWithStandardLibrary
// Marshal is exported by gojson/json package.
Marshal = json.Marshal
// Unmarshal is exported by gojson/json package.
Unmarshal = json.Unmarshal
// MarshalIndent is exported by gojson/json package.
MarshalIndent = json.MarshalIndent
// NewDecoder is exported by gojson/json package.
NewDecoder = json.NewDecoder
// NewEncoder is exported by gojson/json package.
NewEncoder = json.NewEncoder
)

@ -0,0 +1,27 @@
// Copyright 2022 Gin Core Team. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
//go:build sonic && avx && (linux || windows || darwin) && amd64
// +build sonic
// +build avx
// +build linux windows darwin
// +build amd64
package json
import "github.com/bytedance/sonic"
var (
json = sonic.ConfigStd
// Marshal is exported by gojson/json package.
Marshal = json.Marshal
// Unmarshal is exported by gojson/json package.
Unmarshal = json.Unmarshal
// MarshalIndent is exported by gojson/json package.
MarshalIndent = json.MarshalIndent
// NewDecoder is exported by gojson/json package.
NewDecoder = json.NewDecoder
// NewEncoder is exported by gojson/json package.
NewEncoder = json.NewEncoder
)

@ -30,7 +30,7 @@ type Bucket struct {
// reader io.Reader instance for reading the data for uploading
// options the options for uploading the object. The valid options here are CacheControl, ContentDisposition, ContentEncoding
// Expires, ServerSideEncryption, ObjectACL and Meta. Refer to the link below for more details.
// https://help.aliyun.com/document_detail/oss/api-reference/object/PutObject.html
// https://www.alibabacloud.com/help/en/object-storage-service/latest/putobject
//
// error it's nil if no error, otherwise it's an error object.
//
@ -119,7 +119,7 @@ func (bucket Bucket) DoPutObject(request *PutObjectRequest, options []Option) (*
// objectKey the object key.
// options the options for downloading the object. The valid values are: Range, IfModifiedSince, IfUnmodifiedSince, IfMatch,
// IfNoneMatch, AcceptEncoding. For more details, please check out:
// https://help.aliyun.com/document_detail/oss/api-reference/object/GetObject.html
// https://www.alibabacloud.com/help/en/object-storage-service/latest/getobject
//
// io.ReadCloser reader instance for reading data from response. It must be called close() after the usage and only valid when error is nil.
// error it's nil if no error, otherwise it's an error object.
@ -228,7 +228,7 @@ func (bucket Bucket) DoGetObject(request *GetObjectRequest, options []Option) (*
// CopySourceIfNoneMatch, CopySourceIfModifiedSince, CopySourceIfUnmodifiedSince, MetadataDirective.
// Also you can specify the target object's attributes, such as CacheControl, ContentDisposition, ContentEncoding, Expires,
// ServerSideEncryption, ObjectACL, Meta. Refer to the link below for more details :
// https://help.aliyun.com/document_detail/oss/api-reference/object/CopyObject.html
// https://www.alibabacloud.com/help/en/object-storage-service/latest/copyobject
//
// error it's nil if no error, otherwise it's an error object.
//
@ -595,8 +595,8 @@ func (bucket Bucket) ListObjects(options ...Option) (ListObjectsResult, error) {
return out, err
}
// ListObjectsV2 lists the objects under the current bucket.
// Recommend to use ListObjectsV2 to replace ListObjects
// ListOListObjectsV2bjects lists the objects under the current bucket.
// ListObjectsResultV2 the return value after operation succeeds (only valid when error is nil).
func (bucket Bucket) ListObjectsV2(options ...Option) (ListObjectsResultV2, error) {
var out ListObjectsResultV2
@ -667,7 +667,7 @@ func (bucket Bucket) SetObjectMeta(objectKey string, options ...Option) error {
//
// objectKey object key.
// options the constraints of the object. Only when the object meets the requirements this method will return the metadata. Otherwise returns error. Valid options are IfModifiedSince, IfUnmodifiedSince,
// IfMatch, IfNoneMatch. For more details check out https://help.aliyun.com/document_detail/oss/api-reference/object/HeadObject.html
// IfMatch, IfNoneMatch. For more details check out https://www.alibabacloud.com/help/en/object-storage-service/latest/headobject
//
// http.Header object meta when error is nil.
// error it's nil if no error, otherwise it's an error object.
@ -921,7 +921,7 @@ func (bucket Bucket) SignURL(objectKey string, method HTTPMethod, expiredInSec i
// reader io.Reader the read instance for reading the data for the upload.
// options the options for uploading the data. The valid options are CacheControl, ContentDisposition, ContentEncoding,
// Expires, ServerSideEncryption, ObjectACL and custom metadata. Check out the following link for details:
// https://help.aliyun.com/document_detail/oss/api-reference/object/PutObject.html
// https://www.alibabacloud.com/help/en/object-storage-service/latest/putobject
//
// error it's nil if no error, otherwise it's an error object.
//
@ -995,7 +995,7 @@ func (bucket Bucket) DoPutObjectWithURL(signedURL string, reader io.Reader, opti
// signedURL the signed URL.
// options options for downloading the object. Valid options are IfModifiedSince, IfUnmodifiedSince, IfMatch,
// IfNoneMatch, AcceptEncoding. For more information, check out the following link:
// https://help.aliyun.com/document_detail/oss/api-reference/object/GetObject.html
// https://www.alibabacloud.com/help/en/object-storage-service/latest/getobject
//
// io.ReadCloser the reader object for getting the data from response. It needs be closed after the usage. It's only valid when error is nil.
// error it's nil if no error, otherwise it's an error object.

@ -284,7 +284,7 @@ func (client Client) DeleteBucket(bucketName string, options ...Option) error {
// GetBucketLocation gets the bucket location.
//
// Checks out the following link for more information :
// https://help.aliyun.com/document_detail/oss/user_guide/oss_concept/endpoint.html
// https://www.alibabacloud.com/help/en/object-storage-service/latest/getbucketlocation
//
// bucketName the bucket name
//
@ -348,7 +348,7 @@ func (client Client) GetBucketACL(bucketName string, options ...Option) (GetBuck
// SetBucketLifecycle sets the bucket's lifecycle.
//
// For more information, checks out following link:
// https://help.aliyun.com/document_detail/oss/user_guide/manage_object/object_lifecycle.html
// https://www.alibabacloud.com/help/en/object-storage-service/latest/putbucketlifecycle
//
// bucketName the bucket name.
// rules the lifecycle rules. There're two kind of rules: absolute time expiration and relative time expiration in days and day/month/year respectively.
@ -466,26 +466,26 @@ func (client Client) GetBucketLifecycleXml(bucketName string, options ...Option)
// SetBucketReferer sets the bucket's referer whitelist and the flag if allowing empty referrer.
//
// To avoid stealing link on OSS data, OSS supports the HTTP referrer header. A whitelist referrer could be set either by API or web console, as well as
// the allowing empty referrer flag. Note that this applies to requests from webbrowser only.
// the allowing empty referrer flag. Note that this applies to requests from web browser only.
// For example, for a bucket os-example and its referrer http://www.aliyun.com, all requests from this URL could access the bucket.
// For more information, please check out this link :
// https://help.aliyun.com/document_detail/oss/user_guide/security_management/referer.html
// https://www.alibabacloud.com/help/en/object-storage-service/latest/putbucketreferer
//
// bucketName the bucket name.
// referers the referrer white list. A bucket could have a referrer list and each referrer supports one '*' and multiple '?' as wildcards.
// referrers the referrer white list. A bucket could have a referrer list and each referrer supports one '*' and multiple '?' as wildcards.
// The sample could be found in sample/bucket_referer.go
// allowEmptyReferer the flag of allowing empty referrer. By default it's true.
//
// error it's nil if no error, otherwise it's an error object.
//
func (client Client) SetBucketReferer(bucketName string, referers []string, allowEmptyReferer bool, options ...Option) error {
func (client Client) SetBucketReferer(bucketName string, referrers []string, allowEmptyReferer bool, options ...Option) error {
rxml := RefererXML{}
rxml.AllowEmptyReferer = allowEmptyReferer
if referers == nil {
if referrers == nil {
rxml.RefererList = append(rxml.RefererList, "")
} else {
for _, referer := range referers {
rxml.RefererList = append(rxml.RefererList, referer)
for _, referrer := range referrers {
rxml.RefererList = append(rxml.RefererList, referrer)
}
}
@ -535,7 +535,7 @@ func (client Client) GetBucketReferer(bucketName string, options ...Option) (Get
//
// OSS could automatically store the access log. Only the bucket owner could enable the logging.
// Once enabled, OSS would save all the access log into hourly log files in a specified bucket.
// For more information, please check out https://help.aliyun.com/document_detail/oss/user_guide/security_management/logging.html
// For more information, please check out https://www.alibabacloud.com/help/en/object-storage-service/latest/putbucketlogging
//
// bucketName bucket name to enable the log.
// targetBucket the target bucket name to store the log files.
@ -619,7 +619,7 @@ func (client Client) GetBucketLogging(bucketName string, options ...Option) (Get
// SetBucketWebsite sets the bucket's static website's index and error page.
//
// OSS supports static web site hosting for the bucket data. When the bucket is enabled with that, you can access the file in the bucket like the way to access a static website.
// For more information, please check out: https://help.aliyun.com/document_detail/oss/user_guide/static_host_website.html
// For more information, please check out: https://www.alibabacloud.com/help/en/object-storage-service/latest/putbucketwebsite
//
// bucketName the bucket name to enable static web site.
// indexDocument index page.
@ -656,7 +656,7 @@ func (client Client) SetBucketWebsite(bucketName, indexDocument, errorDocument s
// SetBucketWebsiteDetail sets the bucket's static website's detail
//
// OSS supports static web site hosting for the bucket data. When the bucket is enabled with that, you can access the file in the bucket like the way to access a static website.
// For more information, please check out: https://help.aliyun.com/document_detail/oss/user_guide/static_host_website.html
// For more information, please check out: https://www.alibabacloud.com/help/en/object-storage-service/latest/putbucketwebsite
//
// bucketName the bucket name to enable static web site.
//
@ -689,7 +689,7 @@ func (client Client) SetBucketWebsiteDetail(bucketName string, wxml WebsiteXML,
// SetBucketWebsiteXml sets the bucket's static website's rule
//
// OSS supports static web site hosting for the bucket data. When the bucket is enabled with that, you can access the file in the bucket like the way to access a static website.
// For more information, please check out: https://help.aliyun.com/document_detail/oss/user_guide/static_host_website.html
// For more information, please check out: https://www.alibabacloud.com/help/en/object-storage-service/latest/putbucketwebsite
//
// bucketName the bucket name to enable static web site.
//
@ -777,8 +777,7 @@ func (client Client) GetMetaQueryStatus(bucketName string, options ...Option) (G
// metaQuery the option of query
//
// DoMetaQueryResult the result object upon successful request. It's only valid when error is nil.
// error it's nil if no error, otherwise it's an error object.
// error it's nil if no error, otherwise it's an error object.
//
func (client Client) DoMetaQuery(bucketName string, metaQuery MetaQuery, options ...Option) (DoMetaQueryResult, error) {
var out DoMetaQueryResult
@ -790,14 +789,13 @@ func (client Client) DoMetaQuery(bucketName string, metaQuery MetaQuery, options
return out, err
}
// DoMetaQuery Queries the objects that meet specified conditions and lists the information about objects based on specified fields and sorting methods.
// DoMetaQueryXml Queries the objects that meet specified conditions and lists the information about objects based on specified fields and sorting methods.
//
// bucketName the bucket name
//
// metaQuery the option of query
//
// DoMetaQueryResult the result object upon successful request. It's only valid when error is nil.
// error it's nil if no error, otherwise it's an error object.
//
func (client Client) DoMetaQueryXml(bucketName string, metaQueryXml string, options ...Option) (DoMetaQueryResult, error) {
@ -1956,6 +1954,43 @@ func (client Client) PutBucketReplication(bucketName string, xmlBody string, opt
return CheckRespCode(resp.StatusCode, []int{http.StatusOK})
}
// PutBucketRTC put bucket replication rtc
// bucketName the bucket name.
// rtc the bucket rtc config.
// error it's nil if no error, otherwise it's an error object.
//
func (client Client) PutBucketRTC(bucketName string, rtc PutBucketRTC, options ...Option) error {
bs, err := xml.Marshal(rtc)
if err != nil {
return err
}
err = client.PutBucketRTCXml(bucketName, string(bs), options...)
return err
}
// PutBucketRTCXml put bucket rtc configuration
// bucketName the bucket name.
// xmlBody the rtc configuration in xml format.
// error it's nil if no error, otherwise it's an error object.
//
func (client Client) PutBucketRTCXml(bucketName string, xmlBody string, options ...Option) error {
buffer := new(bytes.Buffer)
buffer.Write([]byte(xmlBody))
contentType := http.DetectContentType(buffer.Bytes())
headers := map[string]string{}
headers[HTTPHeaderContentType] = contentType
params := map[string]interface{}{}
params["rtc"] = nil
resp, err := client.do("PUT", bucketName, params, headers, buffer, options...)
if err != nil {
return err
}
defer resp.Body.Close()
return CheckRespCode(resp.StatusCode, []int{http.StatusOK})
}
// GetBucketReplication get bucket replication configuration
// bucketName the bucket name.
// string the replication configuration.
@ -2069,7 +2104,7 @@ func (client Client) GetBucketAccessMonitor(bucketName string, options ...Option
return out, err
}
// GetBucketAccessMonitor get bucket's access monitor config
// GetBucketAccessMonitorXml get bucket's access monitor config
// bucketName the bucket name.
// string the access monitor configuration result of bucket xml foramt.
// error it's nil if no error, otherwise it's an error object.
@ -2099,7 +2134,7 @@ func (client Client) PutBucketAccessMonitor(bucketName string, accessMonitor Put
return err
}
// PutBucketAccessMonitor get bucket's access monitor config
// PutBucketAccessMonitorXml get bucket's access monitor config
// bucketName the bucket name.
// xmlData the access monitor configuration in xml foramt
// error it's nil if no error, otherwise it's an error object.
@ -2119,6 +2154,20 @@ func (client Client) PutBucketAccessMonitorXml(bucketName string, xmlData string
return CheckRespCode(resp.StatusCode, []int{http.StatusOK})
}
// ListBucketCname list bucket's binding cname
// bucketName the bucket name.
// string the xml configuration of bucket.
// error it's nil if no error, otherwise it's an error object.
func (client Client) ListBucketCname(bucketName string, options ...Option) (ListBucketCnameResult, error) {
var out ListBucketCnameResult
body, err := client.GetBucketCname(bucketName, options...)
if err != nil {
return out, err
}
err = xmlUnmarshal(strings.NewReader(body), &out)
return out, err
}
// GetBucketCname get bucket's binding cname
// bucketName the bucket name.
// string the xml configuration of bucket.
@ -2194,7 +2243,7 @@ func (client Client) GetBucketCnameToken(bucketName string, cname string, option
return out, err
}
// PutBucketCname map a custom domain name to a bucket
// PutBucketCnameXml map a custom domain name to a bucket
// bucketName the bucket name.
// xmlBody the cname configuration in xml foramt
// error it's nil if no error, otherwise it's an error object.
@ -2224,7 +2273,6 @@ func (client Client) PutBucketCnameXml(bucketName string, xmlBody string, option
func (client Client) PutBucketCname(bucketName string, cname string, options ...Option) error {
rxml := CnameConfigurationXML{}
rxml.Domain = cname
bs, err := xml.Marshal(rxml)
if err != nil {
return err
@ -2232,6 +2280,18 @@ func (client Client) PutBucketCname(bucketName string, cname string, options ...
return client.PutBucketCnameXml(bucketName, string(bs), options...)
}
// PutBucketCnameWithCertificate map a custom domain name to a bucket
// bucketName the bucket name.
// PutBucketCname the bucket cname config in struct format.
// error it's nil if no error, otherwise it's an error object.
func (client Client) PutBucketCnameWithCertificate(bucketName string, putBucketCname PutBucketCname, options ...Option) error {
bs, err := xml.Marshal(putBucketCname)
if err != nil {
return err
}
return client.PutBucketCnameXml(bucketName, string(bs), options...)
}
// DeleteBucketCname remove the mapping of the custom domain name from a bucket.
// bucketName the bucket name.
// cname a custom domain name.
@ -2263,6 +2323,175 @@ func (client Client) DeleteBucketCname(bucketName string, cname string, options
return CheckRespCode(resp.StatusCode, []int{http.StatusOK})
}
// PutBucketResourceGroup set bucket's resource group
// bucketName the bucket name.
// resourceGroup the resource group configuration of bucket.
// error it's nil if no error, otherwise it's an error object.
func (client Client) PutBucketResourceGroup(bucketName string, resourceGroup PutBucketResourceGroup, options ...Option) error {
bs, err := xml.Marshal(resourceGroup)
if err != nil {
return err
}
err = client.PutBucketResourceGroupXml(bucketName, string(bs), options...)
return err
}
// PutBucketResourceGroupXml set bucket's resource group
// bucketName the bucket name.
// xmlData the resource group in xml format
// error it's nil if no error, otherwise it's an error object.
func (client Client) PutBucketResourceGroupXml(bucketName string, xmlData string, options ...Option) error {
buffer := new(bytes.Buffer)
buffer.Write([]byte(xmlData))
contentType := http.DetectContentType(buffer.Bytes())
headers := map[string]string{}
headers[HTTPHeaderContentType] = contentType
params := map[string]interface{}{}
params["resourceGroup"] = nil
resp, err := client.do("PUT", bucketName, params, nil, buffer, options...)
if err != nil {
return err
}
defer resp.Body.Close()
return CheckRespCode(resp.StatusCode, []int{http.StatusOK})
}
// GetBucketResourceGroup get bucket's resource group
// bucketName the bucket name.
// GetBucketResourceGroupResult the resource group configuration result of bucket.
// error it's nil if no error, otherwise it's an error object.
func (client Client) GetBucketResourceGroup(bucketName string, options ...Option) (GetBucketResourceGroupResult, error) {
var out GetBucketResourceGroupResult
body, err := client.GetBucketResourceGroupXml(bucketName, options...)
err = xmlUnmarshal(strings.NewReader(body), &out)
return out, err
}
// GetBucketResourceGroupXml get bucket's resource group
// bucketName the bucket name.
// string the resource group result of bucket xml format.
// error it's nil if no error, otherwise it's an error object.
func (client Client) GetBucketResourceGroupXml(bucketName string, options ...Option) (string, error) {
params := map[string]interface{}{}
params["resourceGroup"] = nil
resp, err := client.do("GET", bucketName, params, nil, nil, options...)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
out := string(body)
return out, err
}
// PutBucketStyle set bucket's style
// bucketName the bucket name.
// styleContent the style content.
// error it's nil if no error, otherwise it's an error object.
func (client Client) PutBucketStyle(bucketName, styleName string, styleContent string, options ...Option) error {
bs := fmt.Sprintf("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Style><Content>%s</Content></Style>", styleContent)
err := client.PutBucketStyleXml(bucketName, styleName, bs, options...)
return err
}
// PutBucketStyleXml set bucket's style
// bucketName the bucket name.
// styleName the style name.
// xmlData the style in xml format
// error it's nil if no error, otherwise it's an error object.
func (client Client) PutBucketStyleXml(bucketName, styleName, xmlData string, options ...Option) error {
buffer := new(bytes.Buffer)
buffer.Write([]byte(xmlData))
contentType := http.DetectContentType(buffer.Bytes())
headers := map[string]string{}
headers[HTTPHeaderContentType] = contentType
params := map[string]interface{}{}
params["style"] = nil
params["styleName"] = styleName
resp, err := client.do("PUT", bucketName, params, nil, buffer, options...)
if err != nil {
return err
}
defer resp.Body.Close()
return CheckRespCode(resp.StatusCode, []int{http.StatusOK})
}
// GetBucketStyle get bucket's style
// bucketName the bucket name.
// styleName the bucket style name.
// GetBucketStyleResult the style result of bucket.
// error it's nil if no error, otherwise it's an error object.
func (client Client) GetBucketStyle(bucketName, styleName string, options ...Option) (GetBucketStyleResult, error) {
var out GetBucketStyleResult
body, err := client.GetBucketStyleXml(bucketName, styleName, options...)
err = xmlUnmarshal(strings.NewReader(body), &out)
return out, err
}
// GetBucketStyleXml get bucket's style
// bucketName the bucket name.
// styleName the bucket style name.
// string the style result of bucket in xml format.
// error it's nil if no error, otherwise it's an error object.
func (client Client) GetBucketStyleXml(bucketName, styleName string, options ...Option) (string, error) {
params := map[string]interface{}{}
params["style"] = nil
params["styleName"] = styleName
resp, err := client.do("GET", bucketName, params, nil, nil, options...)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
out := string(body)
return out, err
}
// ListBucketStyle get bucket's styles
// bucketName the bucket name.
// GetBucketListStyleResult the list style result of bucket.
// error it's nil if no error, otherwise it's an error object.
func (client Client) ListBucketStyle(bucketName string, options ...Option) (GetBucketListStyleResult, error) {
var out GetBucketListStyleResult
body, err := client.ListBucketStyleXml(bucketName, options...)
err = xmlUnmarshal(strings.NewReader(body), &out)
return out, err
}
// ListBucketStyleXml get bucket's list style
// bucketName the bucket name.
// string the style result of bucket in xml format.
// error it's nil if no error, otherwise it's an error object.
func (client Client) ListBucketStyleXml(bucketName string, options ...Option) (string, error) {
params := map[string]interface{}{}
params["style"] = nil
resp, err := client.do("GET", bucketName, params, nil, nil, options...)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
out := string(body)
return out, err
}
// DeleteBucketStyle delete bucket's style
// bucketName the bucket name.
// styleName the bucket style name.
// string the style result of bucket in xml format.
// error it's nil if no error, otherwise it's an error object.
func (client Client) DeleteBucketStyle(bucketName, styleName string, options ...Option) error {
params := map[string]interface{}{}
params["style"] = bucketName
params["styleName"] = styleName
resp, err := client.do("DELETE", bucketName, params, nil, nil, options...)
if err != nil {
return err
}
defer resp.Body.Close()
return CheckRespCode(resp.StatusCode, []int{http.StatusNoContent})
}
// LimitUploadSpeed set upload bandwidth limit speed,default is 0,unlimited
// upSpeed KB/s, 0 is unlimited,default is 0
// error it's nil if success, otherwise failure
@ -2435,14 +2664,14 @@ func SetLogger(Logger *log.Logger) ClientOption {
}
}
// SetCredentialsProvider sets funciton for get the user's ak
// SetCredentialsProvider sets function for get the user's ak
func SetCredentialsProvider(provider CredentialsProvider) ClientOption {
return func(client *Client) {
client.Config.CredentialsProvider = provider
}
}
// SetLocalAddr sets funciton for local addr
// SetLocalAddr sets function for local addr
func SetLocalAddr(localAddr net.Addr) ClientOption {
return func(client *Client) {
client.Config.LocalAddr = localAddr
@ -2463,14 +2692,14 @@ func AdditionalHeaders(headers []string) ClientOption {
}
}
// only effective from go1.7 onward,RedirectEnabled set http redirect enabled or not
// RedirectEnabled only effective from go1.7 onward,RedirectEnabled set http redirect enabled or not
func RedirectEnabled(enabled bool) ClientOption {
return func(client *Client) {
client.Config.RedirectEnabled = enabled
}
}
// skip verifying tls certificate file
// InsecureSkipVerify skip verifying tls certificate file
func InsecureSkipVerify(enabled bool) ClientOption {
return func(client *Client) {
client.Config.InsecureSkipVerify = enabled

@ -49,7 +49,7 @@ var signKeyList = []string{"acl", "uploads", "location", "cors",
"x-oss-enable-md5", "x-oss-enable-sha1", "x-oss-enable-sha256",
"x-oss-hash-ctx", "x-oss-md5-ctx", "transferAcceleration",
"regionList", "cloudboxes", "x-oss-ac-source-ip", "x-oss-ac-subnet-mask", "x-oss-ac-vpc-id", "x-oss-ac-forward-allow",
"metaQuery",
"metaQuery", "resourceGroup", "rtc",
}
// init initializes Conn
@ -506,27 +506,37 @@ func (conn Conn) handleResponse(resp *http.Response, crc hash.Hash64) (*Response
if statusCode >= 400 && statusCode <= 505 {
// 4xx and 5xx indicate that the operation has error occurred
var respBody []byte
var errorXml []byte
respBody, err := readResponseBody(resp)
if err != nil {
return nil, err
}
if len(respBody) == 0 {
errorXml = respBody
if len(respBody) == 0 && len(resp.Header.Get(HTTPHeaderOssErr)) > 0 {
errorXml, err = base64.StdEncoding.DecodeString(resp.Header.Get(HTTPHeaderOssErr))
if err != nil {
errorXml = respBody
}
}
if len(errorXml) == 0 {
err = ServiceError{
StatusCode: statusCode,
RequestID: resp.Header.Get(HTTPHeaderOssRequestID),
Ec: resp.Header.Get(HTTPHeaderOssEc),
}
} else {
// Response contains storage service error object, unmarshal
srvErr, errIn := serviceErrFromXML(respBody, resp.StatusCode,
srvErr, errIn := serviceErrFromXML(errorXml, resp.StatusCode,
resp.Header.Get(HTTPHeaderOssRequestID))
if errIn != nil { // error unmarshaling the error response
err = fmt.Errorf("oss: service returned invalid response body, status = %s, RequestId = %s", resp.Status, resp.Header.Get(HTTPHeaderOssRequestID))
if errIn != nil { // error unmarshal the error response
if len(resp.Header.Get(HTTPHeaderOssEc)) > 0 {
err = fmt.Errorf("oss: service returned invalid response body, status = %s, RequestId = %s, ec = %s", resp.Status, resp.Header.Get(HTTPHeaderOssRequestID), resp.Header.Get(HTTPHeaderOssEc))
} else {
err = fmt.Errorf("oss: service returned invalid response body, status = %s, RequestId = %s", resp.Status, resp.Header.Get(HTTPHeaderOssRequestID))
}
} else {
err = srvErr
}
}
return &Response{
StatusCode: resp.StatusCode,
Headers: resp.Header,
@ -544,27 +554,37 @@ func (conn Conn) handleResponse(resp *http.Response, crc hash.Hash64) (*Response
// (0,300) [308,400) [506,)
// Other extended http StatusCode
var respBody []byte
var errorXml []byte
respBody, err := readResponseBody(resp)
if err != nil {
return &Response{StatusCode: resp.StatusCode, Headers: resp.Header, Body: ioutil.NopCloser(bytes.NewReader(respBody))}, err
}
if len(respBody) == 0 {
errorXml = respBody
if len(respBody) == 0 && len(resp.Header.Get(HTTPHeaderOssErr)) > 0 {
errorXml, err = base64.StdEncoding.DecodeString(resp.Header.Get(HTTPHeaderOssErr))
if err != nil {
errorXml = respBody
}
}
if len(errorXml) == 0 {
err = ServiceError{
StatusCode: statusCode,
RequestID: resp.Header.Get(HTTPHeaderOssRequestID),
Ec: resp.Header.Get(HTTPHeaderOssEc),
}
} else {
// Response contains storage service error object, unmarshal
srvErr, errIn := serviceErrFromXML(respBody, resp.StatusCode,
srvErr, errIn := serviceErrFromXML(errorXml, resp.StatusCode,
resp.Header.Get(HTTPHeaderOssRequestID))
if errIn != nil { // error unmarshaling the error response
err = fmt.Errorf("unkown response body, status = %s, RequestId = %s", resp.Status, resp.Header.Get(HTTPHeaderOssRequestID))
if errIn != nil { // error unmarshal the error response
if len(resp.Header.Get(HTTPHeaderOssEc)) > 0 {
err = fmt.Errorf("unknown response body, status = %s, RequestId = %s, ec = %s", resp.Status, resp.Header.Get(HTTPHeaderOssRequestID), resp.Header.Get(HTTPHeaderOssEc))
} else {
err = fmt.Errorf("unknown response body, status = %s, RequestId = %s", resp.Status, resp.Header.Get(HTTPHeaderOssRequestID))
}
} else {
err = srvErr
}
}
return &Response{
StatusCode: resp.StatusCode,
Headers: resp.Header,

@ -207,6 +207,8 @@ const (
HttpHeaderOssDate = "X-Oss-Date"
HttpHeaderOssContentSha256 = "X-Oss-Content-Sha256"
HttpHeaderOssNotification = "X-Oss-Notification"
HTTPHeaderOssEc = "X-Oss-Ec"
HTTPHeaderOssErr = "X-Oss-Err"
)
// HTTP Param
@ -240,7 +242,7 @@ const (
DefaultContentSha256 = "UNSIGNED-PAYLOAD" // for v4 signature
Version = "v2.2.6" // Go SDK version
Version = "v2.2.7" // Go SDK version
)
// FrameType

@ -15,18 +15,22 @@ type ServiceError struct {
RequestID string `xml:"RequestId"` // The UUID used to uniquely identify the request
HostID string `xml:"HostId"` // The OSS server cluster's Id
Endpoint string `xml:"Endpoint"`
Ec string `xml:"EC"`
RawMessage string // The raw messages from OSS
StatusCode int // HTTP status code
}
// Error implements interface error
func (e ServiceError) Error() string {
if e.Endpoint == "" {
return fmt.Sprintf("oss: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=\"%s\", RequestId=%s",
e.StatusCode, e.Code, e.Message, e.RequestID)
errorStr := fmt.Sprintf("oss: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=\"%s\", RequestId=%s", e.StatusCode, e.Code, e.Message, e.RequestID)
if len(e.Endpoint) > 0 {
errorStr = fmt.Sprintf("%s, Endpoint=%s", errorStr, e.Endpoint)
}
if len(e.Ec) > 0 {
errorStr = fmt.Sprintf("%s, Ec=%s", errorStr, e.Ec)
}
return fmt.Sprintf("oss: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=\"%s\", RequestId=%s, Endpoint=%s",
e.StatusCode, e.Code, e.Message, e.RequestID, e.Endpoint)
return errorStr
}
// UnexpectedStatusCodeError is returned when a storage service responds with neither an error

@ -16,7 +16,7 @@ import (
// objectKey object name
// options the object constricts for upload. The valid options are CacheControl, ContentDisposition, ContentEncoding, Expires,
// ServerSideEncryption, Meta, check out the following link:
// https://help.aliyun.com/document_detail/oss/api-reference/multipart-upload/InitiateMultipartUpload.html
// https://www.alibabacloud.com/help/en/object-storage-service/latest/initiatemultipartupload
//
// InitiateMultipartUploadResult the return value of the InitiateMultipartUpload, which is used for calls later on such as UploadPartFromFile,UploadPartCopy.
// error it's nil if the operation succeeds, otherwise it's an error object.
@ -145,7 +145,7 @@ func (bucket Bucket) DoUploadPart(request *UploadPartRequest, options []Option)
// partNumber the part number, ranges from 1 to 10,000. If it exceeds the range OSS returns InvalidArgument error.
// options the constraints of source object for the copy. The copy happens only when these contraints are met. Otherwise it returns error.
// CopySourceIfNoneMatch, CopySourceIfModifiedSince CopySourceIfUnmodifiedSince, check out the following link for the detail
// https://help.aliyun.com/document_detail/oss/api-reference/multipart-upload/UploadPartCopy.html
// https://www.alibabacloud.com/help/en/object-storage-service/latest/uploadpartcopy
//
// UploadPart the return value consists of PartNumber and ETag.
// error it's nil if the operation succeeds, otherwise it's an error object.

@ -31,7 +31,7 @@ type BucketProperties struct {
StorageClass string `xml:"StorageClass"` // Bucket storage class
}
// ListCloudBoxesResult defines the result object from ListBuckets request
// ListCloudBoxResult defines the result object from ListBuckets request
type ListCloudBoxResult struct {
XMLName xml.Name `xml:"ListCloudBoxResult"`
Prefix string `xml:"Prefix"` // The prefix in this query
@ -482,13 +482,13 @@ type DeleteObjectsResult struct {
DeletedObjects []string // Deleted object key list
}
// DeleteObjectsResult_inner defines result of DeleteObjects request
// DeleteObjectVersionsResult defines result of DeleteObjects request
type DeleteObjectVersionsResult struct {
XMLName xml.Name `xml:"DeleteResult"`
DeletedObjectsDetail []DeletedKeyInfo `xml:"Deleted"` // Deleted object detail info
}
// DeleteKeyInfo defines object delete info
// DeletedKeyInfo defines object delete info
type DeletedKeyInfo struct {
XMLName xml.Name `xml:"Deleted"`
Key string `xml:"Key"` // Object key
@ -931,13 +931,13 @@ type Tag struct {
Value string `xml:"Value"`
}
// Tagging tagset for the object
// Tagging tag set for the object
type Tagging struct {
XMLName xml.Name `xml:"Tagging"`
Tags []Tag `xml:"TagSet>Tag,omitempty"`
}
// for GetObjectTagging return value
// GetObjectTaggingResult for GetObjectTagging return value
type GetObjectTaggingResult Tagging
// VersioningConfig for the bucket
@ -948,13 +948,13 @@ type VersioningConfig struct {
type GetBucketVersioningResult VersioningConfig
// Server Encryption rule for the bucket
// ServerEncryptionRule Server Encryption rule for the bucket
type ServerEncryptionRule struct {
XMLName xml.Name `xml:"ServerSideEncryptionRule"`
SSEDefault SSEDefaultRule `xml:"ApplyServerSideEncryptionByDefault"`
}
// Server Encryption deafult rule for the bucket
// SSEDefaultRule Server Encryption deafult rule for the bucket
type SSEDefaultRule struct {
XMLName xml.Name `xml:"ApplyServerSideEncryptionByDefault"`
SSEAlgorithm string `xml:"SSEAlgorithm,omitempty"`
@ -1165,7 +1165,7 @@ func (selectReq *SelectRequest) jsonEncodeBase64() {
}
}
// CsvOptions is a element in the SelectObject api request's params
// SelectOptions is a element in the SelectObject api request's params
type SelectOptions struct {
XMLName xml.Name `xml:"Options"`
SkipPartialDataRecord *bool `xml:"SkipPartialDataRecord,omitempty"`
@ -1349,12 +1349,112 @@ type ReplicationXML struct {
ID string `xml:"ID,omitempty"`
}
// PutBucketReplication define the bucket replication config
type PutBucketReplication BucketReplicationXml
// GetBucketReplicationResult define get bucket's replication config
type GetBucketReplicationResult BucketReplicationXml
// GetBucketReplicationLocationResult define get bucket's replication location
type GetBucketReplicationLocationResult BucketReplicationLocationXml
// GetBucketReplicationProgressResult define get bucket's replication progress
type GetBucketReplicationProgressResult BucketReplicationProgressXml
// PutBucketRTC define the bucket rtc config
type PutBucketRTC BucketRTCXml
// BucketReplicationXml define the xml of bucket replication config
type BucketReplicationXml struct {
XMLName xml.Name `xml:"ReplicationConfiguration"`
Rule []ReplicationRule `xml:"Rule,omitempty"`
}
// BucketReplicationProgressXml define the xml of bucket replication config
type BucketReplicationProgressXml struct {
XMLName xml.Name `xml:"ReplicationProgress"`
Rule []ReplicationRule `xml:"Rule,omitempty"`
}
// BucketRTCXml define the xml of bucket rtc config
type BucketRTCXml struct {
XMLName xml.Name `xml:"ReplicationRule"`
RTC *string `xml:"RTC>Status,omitempty"`
ID string `xml:"ID,omitempty"`
}
// ReplicationRule define the xml of bucket replication config rule
type ReplicationRule struct {
ID string `xml:"ID,omitempty"`
RTC *string `xml:"RTC>Status,omitempty"`
PrefixSet *ReplicationRulePrefix `xml:"PrefixSet,omitempty"`
Action string `xml:"Action,omitempty"`
Destination *ReplicationRuleDestination `xml:"Destination,omitempty"`
HistoricalObjectReplication string `xml:"HistoricalObjectReplication,omitempty"`
Status string `xml:"Status,omitempty"`
SyncRole string `xml:"SyncRole,omitempty"`
SourceSelectionCriteria *string `xml:"SourceSelectionCriteria>SseKmsEncryptedObjects>Status,omitempty"`
EncryptionConfiguration *string `xml:"EncryptionConfiguration>ReplicaKmsKeyID,omitempty"`
Progress *ReplicationRuleProgress `xml:"Progress,omitempty"`
HistoricalObject string `xml:"HistoricalObject,omitempty"`
}
type ReplicationRulePrefix struct {
Prefix []*string `xml:"Prefix,omitempty"`
}
type ReplicationRuleDestination struct {
Bucket string `xml:"Bucket,omitempty"`
Location string `xml:"Location,omitempty"`
TransferType string `xml:"TransferType,omitempty"`
}
// BucketReplicationLocationXml define the xml of bucket replication location info
type BucketReplicationLocationXml struct {
XMLName xml.Name `xml:"ReplicationLocation"`
Location []string `xml:"Location,omitempty"`
LocationTransferType []ReplicationLocationTransferType `xml:"LocationTransferTypeConstraint>LocationTransferType,omitempty"`
RTCLocation []string `xml:"LocationRTCConstraint>Location,omitempty"`
}
type ReplicationLocation struct {
Location string `xml:"Location,omitempty"`
}
type ReplicationLocationTransferType struct {
Location string `xml:"Location,omitempty"`
TransferTypes string `xml:"TransferTypes>Type,omitempty"`
}
type ReplicationRuleProgress struct {
HistoricalObject string `xml:"HistoricalObject,omitempty"`
NewObject string `xml:"NewObject,omitempty"`
}
// CnameConfigurationXML define cname configuration
type CnameConfigurationXML struct {
XMLName xml.Name `xml:"BucketCnameConfiguration"`
Domain string `xml:"Cname>Domain"`
}
type PutBucketCname PutBucketCnameXml
// PutBucketCnameXml define cname configuration
type PutBucketCnameXml struct {
XMLName xml.Name `xml:"BucketCnameConfiguration"`
Cname string `xml:"Cname>Domain"`
CertificateConfiguration *CertificateConfiguration `xml:"Cname>CertificateConfiguration"`
}
type CertificateConfiguration struct {
CertId string `xml:"CertId,omitempty"`
Certificate string `xml:"Certificate,omitempty"`
PrivateKey string `xml:"PrivateKey,omitempty"`
PreviousCertId string `xml:"PreviousCertId,omitempty"`
Force bool `xml:"Force,omitempty"`
DeleteCertificate bool `xml:"DeleteCertificate,omitempty"`
}
// CnameTokenXML define cname token information
type CnameTokenXML struct {
XMLName xml.Name `xml:"CnameToken"`
@ -1382,7 +1482,7 @@ type GetMetaQueryStatusResultXml struct {
UpdateTime string `xml:"UpdateTime"`
}
// DoMetaQuery defines meta query struct
// MetaQuery defines meta query struct
type MetaQuery struct {
XMLName xml.Name `xml:"MetaQuery"`
NextToken string `xml:"NextToken,omitempty"`
@ -1459,14 +1559,77 @@ type MetaQueryGroup struct {
Count int64 `xml:"Count"`
}
//GetBucketAccessMonitorResult define config for get bucket access monitor
// GetBucketAccessMonitorResult define config for get bucket access monitor
type GetBucketAccessMonitorResult BucketAccessMonitorXml
//BucketAccessMonitor define the xml of bucket access monitor config
// PutBucketAccessMonitor define the xml of bucket access monitor config
type PutBucketAccessMonitor BucketAccessMonitorXml
// GetBucketAccessMonitorXml define get bucket access monitor information
// BucketAccessMonitorXml define get bucket access monitor information
type BucketAccessMonitorXml struct {
XMLName xml.Name `xml:"AccessMonitorConfiguration"`
Status string `xml:"Status"` // access monitor status
}
// ListBucketCnameResult define the cname list of the bucket
type ListBucketCnameResult BucketCnameXml
// BucketCnameXml define get the bucket cname information
type BucketCnameXml struct {
XMLName xml.Name `xml:"ListCnameResult"`
Bucket string `xml:"Bucket"`
Owner string `xml:"Owner"`
Cname []Cname `xml:"Cname"`
}
// Cname define the cname information
type Cname struct {
Domain string `xml:"Domain"`
LastModified string `xml:"LastModified"`
Status string `xml:"Status"`
Certificate Certificate `xml:"Certificate"`
}
// Certificate define Details of domain name certificate
type Certificate struct {
Type string `xml:"Type"`
CertId string `xml:"CertId"`
Status string `xml:"Status"`
CreationDate string `xml:"CreationDate"`
Fingerprint string `xml:"Fingerprint"`
ValidStartDate string `xml:"ValidStartDate"`
ValidEndDate string `xml:"ValidEndDate"`
}
//GetBucketResourceGroupResult define resource group for the bucket
type GetBucketResourceGroupResult BucketResourceGroupXml
//PutBucketResourceGroup define the xml of bucket's resource group config
type PutBucketResourceGroup BucketResourceGroupXml
// BucketResourceGroupXml define the information of the bucket's resource group
type BucketResourceGroupXml struct {
XMLName xml.Name `xml:"BucketResourceGroupConfiguration"`
ResourceGroupId string `xml:"ResourceGroupId"` // resource groupId
}
// GetBucketStyleResult define style for the bucket
type GetBucketStyleResult BucketStyleXml
// GetBucketListStyleResult define the list style for the bucket
type GetBucketListStyleResult BucketListStyleXml
// BucketListStyleXml define the list style of the bucket
type BucketListStyleXml struct {
XMLName xml.Name `xml:"StyleList"`
Style []BucketStyleXml `xml:"Style,omitempty"` // style
}
// BucketStyleXml define the information of the bucket's style
type BucketStyleXml struct {
XMLName xml.Name `xml:"Style"`
Name string `xml:"Name,omitempty"` // style name
Content string `xml:"Content"` // style content
CreateTime string `xml:"CreateTime,omitempty"` // style create time
LastModifyTime string `xml:"LastModifyTime,omitempty"` // style last modify time
}

@ -9,7 +9,6 @@ import (
"io"
"net/http"
"os"
"os/exec"
"runtime"
"strconv"
"strings"
@ -37,16 +36,6 @@ func init() {
sys_name = runtime.GOOS
sys_release = "-"
sys_machine = runtime.GOARCH
if out, err := exec.Command("uname", "-s").CombinedOutput(); err == nil {
sys_name = string(bytes.TrimSpace(out))
}
if out, err := exec.Command("uname", "-r").CombinedOutput(); err == nil {
sys_release = string(bytes.TrimSpace(out))
}
if out, err := exec.Command("uname", "-m").CombinedOutput(); err == nil {
sys_machine = string(bytes.TrimSpace(out))
}
}
// userAgent gets user agent

@ -1,7 +1,7 @@
# github.com/MercuryEngineering/CookieMonster v0.0.0-20180304172713-1584578b3403
## explicit
github.com/MercuryEngineering/CookieMonster
# github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible
# github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
## explicit
github.com/aliyun/aliyun-oss-go-sdk/oss
# github.com/allegro/bigcache/v3 v3.1.0

Loading…
Cancel
Save