Skip to content

Commit

Permalink
remove errant glide from Make
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Stahnke committed Feb 25, 2018
1 parent 3775be5 commit 77740a8
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 60 deletions.
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,28 @@ deps:
GOPATH=$(GOPATH) dep ensure

fmt:
GOPATH=$(GOPATH) go fmt $(glide novendor)
GOPATH=$(GOPATH) go fmt *.go
GOPATH=$(GOPATH) go fmt f5/*.go
GOPATH=$(GOPATH) go tool vet *.go f5/*.go

test: fmt deps
@echo "+++ Is this thing working? :hammer_and_wrench:"
GOPATH=$(GOPATH) go test -cover -v $(glide novendor)
GOPATH=$(GOPATH) go test -cover -v

$(PROJ): deps
CGO_ENABLED=0 GOPATH=$(GOPATH) go build $(LDFLAGS) -o $@ -v $(glide novendor)
CGO_ENABLED=0 GOPATH=$(GOPATH) go build $(LDFLAGS) -o $@ -v
touch $@ && chmod 755 $@

linux: deps
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOPATH=$(GOPATH) go build $(LDFLAGS) -o $(PROJ)-linux-amd64 -v $(glide novendor)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOPATH=$(GOPATH) go build $(LDFLAGS) -o $(PROJ)-linux-amd64 -v
touch $(PROJ)-linux-amd64 && chmod 755 $(PROJ)-linux-amd64

windows: deps
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 GOPATH=$(GOPATH) go build $(LDFLAGS) -o $(PROJ)-windows-amd64.exe -v $(glide novendor)
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 GOPATH=$(GOPATH) go build $(LDFLAGS) -o $(PROJ)-windows-amd64.exe -v
touch $(PROJ)-windows-amd64.exe

darwin: deps
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 GOPATH=$(GOPATH) go build -o $(PROJ)-darwin-amd64 -v $(glide novendor)
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 GOPATH=$(GOPATH) go build -o $(PROJ)-darwin-amd64 -v
touch $(PROJ)-darwin-amd64 && chmod 755 $(PROJ)-darwin-amd64

ifdef TRAVIS_TAG
Expand All @@ -47,4 +48,4 @@ publish: deps
endif

clean:
rm -rf $(PROJ) $(PROJ)-win-amd64.exe $(PROJ)-linux-amd64 $(PROJ)-darwin-amd64 dist
rm -rf $(PROJ) $(PROJ)-windows-amd64.exe $(PROJ)-linux-amd64 $(PROJ)-darwin-amd64 dist
2 changes: 1 addition & 1 deletion f5/client-ssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type LBClientSsl struct {
Renegotiation string `json:"renegotiation"`
RetainCertificate string `json:"retainCertificate"`
SecureRenegotiation string `json:"secureRenegotiation"`
ServerName string `json:"serverName"`
ServerName string `json:"serverName"`
SessionMirroring string `json:"sessionMirroring"`
SessionTicket string `json:"sessionTicket"`
SniDefault string `json:"sniDefault"`
Expand Down
16 changes: 8 additions & 8 deletions f5/command.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package f5

type BashCommand struct {
Command string `json:"command"`
UtilCommandArgs string `json:"utilCmdArgs"`
Command string `json:"command"`
UtilCommandArgs string `json:"utilCmdArgs"`
}

type BashCommandResult struct {
Kind string `json:"kind"`
Command string `json:"command"`
UtilCommandArgs string `json:"utilCmdArgs"`
CommandResult string `json:"commandResult"`
Kind string `json:"kind"`
Command string `json:"command"`
UtilCommandArgs string `json:"utilCmdArgs"`
CommandResult string `json:"commandResult"`
}

func (f *Device) Run(command string) (error, *BashCommandResult) {
u := f.Proto + "://" + f.Hostname + "/mgmt/tm/util/bash"
b := BashCommand { Command:"run", UtilCommandArgs:"-c \"" + command + "\"" }
b := BashCommand{Command: "run", UtilCommandArgs: "-c \"" + command + "\""}
r := BashCommandResult{}
err, _ := f.sendRequest(u, POST, &b, &r)
if err != nil {
return err, nil
}
return nil, &r
}
}
73 changes: 36 additions & 37 deletions f5/crypto.go
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
package f5

import (
"strings"
"errors"
"strings"
)

type SSLCreate struct {
Name string `json:"name"`
Partition string `json:"partition"`
SourcePath string `json:"sourcePath"`
Name string `json:"name"`
Partition string `json:"partition"`
SourcePath string `json:"sourcePath"`
}

type SSLCertificate struct {
Kind string `json:"kind"`
Name string `json:"name"`
Partition string `json:"partition"`
Generation int `json:"generation"`
SelfLink string `json:"selfLink"`
CurveName string `json:"certificateKeyCurveName"`
KeySize int `json:"certificateKeySize"`
Checksum string `json:"checksum"`
CreateTime string `json:"createTime"`
CreatedBy string `json:"createdBy"`
Expiration int `json:"expirationDate"`
ExpireTime string `json:"expirationString"`
IsBundle string `json:"isBundle"`
Issuer string `json:"issuer"`
KeyType string `json:"keyType"`
UpdateTime string `json:"lastUpdateTime"`
Mode int `json:"mode"`
Revision int `json:"revision"`
SerialNum string `json:"serialNumber"`
Size int `json:"size"`
Subject string `json:"subject"`
UpdatedBy string `json:"updatedBy"`
Version int `json:"version"`
Kind string `json:"kind"`
Name string `json:"name"`
Partition string `json:"partition"`
Generation int `json:"generation"`
SelfLink string `json:"selfLink"`
CurveName string `json:"certificateKeyCurveName"`
KeySize int `json:"certificateKeySize"`
Checksum string `json:"checksum"`
CreateTime string `json:"createTime"`
CreatedBy string `json:"createdBy"`
Expiration int `json:"expirationDate"`
ExpireTime string `json:"expirationString"`
IsBundle string `json:"isBundle"`
Issuer string `json:"issuer"`
KeyType string `json:"keyType"`
UpdateTime string `json:"lastUpdateTime"`
Mode int `json:"mode"`
Revision int `json:"revision"`
SerialNum string `json:"serialNumber"`
Size int `json:"size"`
Subject string `json:"subject"`
UpdatedBy string `json:"updatedBy"`
Version int `json:"version"`
}

type SSLCertificates struct {
Kind string `json:"kind"`
SelfLink string `json:"selfLink"`
Items []SSLCertificate `json:"items"`

Kind string `json:"kind"`
SelfLink string `json:"selfLink"`
Items []SSLCertificate `json:"items"`
}

func (f *Device) GetCertificate(partition string, name string) (error, *SSLCertificate) {
if(!strings.HasSuffix(name, ".crt")) {
if !strings.HasSuffix(name, ".crt") {
name = name + ".crt"
}
u := f.Proto + "://" + f.Hostname + "/mgmt/tm/sys/file/ssl-cert/~" + partition + "~" + name
Expand All @@ -70,10 +69,10 @@ func (f *Device) GetCertificates() (error, *SSLCertificates) {
}

func (f *Device) CreateCertificateFromLocalFile(name string, partition string, cert_file string) (error, *SSLCertificate) {
if(!strings.HasSuffix(name, ".crt")) {
if !strings.HasSuffix(name, ".crt") {
name = name + ".crt"
}
b := SSLCreate{ Name:name, Partition:partition, SourcePath:"file:///var/config/rest/downloads/" + cert_file }
b := SSLCreate{Name: name, Partition: partition, SourcePath: "file:///var/config/rest/downloads/" + cert_file}
u := f.Proto + "://" + f.Hostname + "/mgmt/tm/sys/file/ssl-cert"
res := SSLCertificate{}

Expand All @@ -87,13 +86,13 @@ func (f *Device) CreateCertificateFromLocalFile(name string, partition string, c
}

func (f *Device) CreateKeyFromLocalFile(name string, partition string, key_file string) (error, *SSLCertificate) {
if(strings.HasSuffix(name, ".crt")) {
if strings.HasSuffix(name, ".crt") {
return errors.New("The name cannot contain a .crt suffix for keys."), nil
}
if(!strings.HasSuffix(name, ".key")) {
if !strings.HasSuffix(name, ".key") {
name = name + ".key"
}
b := SSLCreate{ Name:name, Partition:partition, SourcePath:"file:///var/config/rest/downloads/" + key_file }
b := SSLCreate{Name: name, Partition: partition, SourcePath: "file:///var/config/rest/downloads/" + key_file}
u := f.Proto + "://" + f.Hostname + "/mgmt/tm/sys/file/ssl-key"
res := SSLCertificate{}

Expand Down
14 changes: 7 additions & 7 deletions f5/file.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package f5

import (
"net/http"
"bytes"
"crypto/tls"
"errors"
"bytes"
"net/http"
"strconv"
)

func (f *Device) UploadFile(filename string, data []byte) (error) {
if(len(data) > 512 * 1024) {
func (f *Device) UploadFile(filename string, data []byte) error {
if len(data) > 512*1024 {
return errors.New("File size is too large, and we dont support chunked file sizes yet.")
}

Expand All @@ -20,10 +20,10 @@ func (f *Device) UploadFile(filename string, data []byte) (error) {
}
request.SetBasicAuth(f.Username, f.Password)
request.Header.Set("Content-Type", "application/octet-stream")
request.Header.Set("Content-Range", "0-" + strconv.Itoa(len(data) - 1) + "/" + strconv.Itoa(len(data)))
request.Header.Set("Content-Range", "0-"+strconv.Itoa(len(data)-1)+"/"+strconv.Itoa(len(data)))
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: tr}
response, err := client.Do(request)
if err != nil {
Expand Down

0 comments on commit 77740a8

Please sign in to comment.