Browse Source

Updated.

master
Mingcai SHEN 5 years ago
parent
commit
ae97cbb4c0
3 changed files with 50 additions and 0 deletions
  1. +2
    -0
      go.mod
  2. +43
    -0
      minio/minio.go
  3. +5
    -0
      mqtt/mqtt.go

+ 2
- 0
go.mod View File

@ -8,6 +8,7 @@ require (
github.com/archsh/go.xql v0.4.1
github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/eclipse/paho.mqtt.golang v1.2.0 // indirect
github.com/fsnotify/fsnotify v1.4.7
github.com/go-redis/redis v0.0.0-20190503082931-75795aa4236d
github.com/golang/snappy v0.0.1
@ -18,6 +19,7 @@ require (
github.com/konsorten/go-windows-terminal-sequences v1.0.2
github.com/lib/pq v1.1.1
github.com/magiconair/properties v1.8.0
github.com/minio/minio-go/v6 v6.0.57 // indirect
github.com/mitchellh/mapstructure v1.1.2
github.com/mozillazg/go-pinyin v0.15.0
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646

+ 43
- 0
minio/minio.go View File

@ -0,0 +1,43 @@
package minio
import (
"net/url"
"strings"
"github.com/minio/minio-go/v6"
)
type MinioOption struct {
Endpoint string
Access string
Secret string
Bucket string
Secure bool
}
func ParseURL(s string) (*MinioOption, error) {
var opt MinioOption
if u, e := url.Parse(s); nil != e {
return nil, e //log.Fatalln(e)
} else {
if strings.ToLower(u.Scheme) == "https" {
opt.Secure = true
}
sss := strings.Split(strings.TrimLeft(u.Path, "/"), "/")
if len(sss) > 0 {
opt.Bucket = sss[0]
}
opt.Endpoint = u.Host
opt.Access = u.User.Username()
opt.Secret, _ = u.User.Password()
}
return &opt, nil
}
func New(u string) (*minio.Client, error) {
if opts, e := ParseURL(u); nil != e {
return nil, e
} else {
return minio.New(opts.Endpoint, opts.Access, opts.Secret, opts.Secure)
}
}

+ 5
- 0
mqtt/mqtt.go View File

@ -0,0 +1,5 @@
package mqtt
func SetupBroker() error {
return nil
}

Loading…
Cancel
Save