mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-27 04:28:20 +00:00
Merge pull request #915 from riyazdf/golinting
Add golint, gofmt, govet
This commit is contained in:
commit
cc72074b11
@ -1,2 +1,8 @@
|
|||||||
FROM golang:1.7-alpine
|
FROM golang:1.7-alpine
|
||||||
RUN apk update && apk add --no-cache build-base git
|
RUN apk update && apk add --no-cache build-base git
|
||||||
|
|
||||||
|
# Get linting tools
|
||||||
|
RUN go get -u github.com/golang/lint/golint
|
||||||
|
|
||||||
|
# Get the linting script and place in PATH
|
||||||
|
COPY lint.sh /usr/bin/lint.sh
|
@ -7,8 +7,8 @@ default: push
|
|||||||
|
|
||||||
hash:
|
hash:
|
||||||
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
||||||
tar cf - Dockerfile | docker build --no-cache -t $(IMAGE):build -
|
tar cf - Dockerfile lint.sh | docker build --no-cache -t $(IMAGE):build -
|
||||||
docker run --rm $(IMAGE):build sh -c 'cat /usr/local/go/bin/go /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > hash
|
docker run --rm $(IMAGE):build sh -c 'cat /usr/local/go/bin/go /lib/apk/db/installed /usr/bin/lint.sh /go/bin/golint | sha1sum' | sed 's/ .*//' > hash
|
||||||
|
|
||||||
push: hash
|
push: hash
|
||||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||||
|
16
alpine/base/alpine-build-go/lint.sh
Executable file
16
alpine/base/alpine-build-go/lint.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd $1
|
||||||
|
|
||||||
|
>&2 echo "gofmt..."
|
||||||
|
test -z $(gofmt -s -l .| grep -v .pb. | grep -v */vendor/ | tee /dev/stderr)
|
||||||
|
|
||||||
|
>&2 echo "govet..."
|
||||||
|
test -z $(go tool vet -printf=false . 2>&1 | grep -v */vendor/ | tee /dev/stderr)
|
||||||
|
|
||||||
|
>&2 echo "golint..."
|
||||||
|
test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr)
|
||||||
|
|
||||||
|
>&2 echo "Successful lint check!"
|
@ -1,5 +1,5 @@
|
|||||||
# Tag: 1ae7bf8ec49a6537a93fba0c90720c65fa1c6ece
|
# Tag: d3f266a146a79f35d3bebf252cce62eee25fcfa9
|
||||||
FROM mobylinux/alpine-build-go@sha256:5e9aed92363c25349c2845b9be4a5285e0f56376b8b3ce92c7361bb59e6eeb2d
|
FROM mobylinux/alpine-build-go@sha256:1eca9f912cfa4f59ad817acad76744516b999395c080bc01a50b3a2b3a9a3f5c
|
||||||
|
|
||||||
COPY *.go /go/src/binfmt/
|
COPY *.go /go/src/binfmt/
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
# Tag: 1ae7bf8ec49a6537a93fba0c90720c65fa1c6ece
|
# Tag: d3f266a146a79f35d3bebf252cce62eee25fcfa9
|
||||||
FROM mobylinux/alpine-build-go@sha256:5e9aed92363c25349c2845b9be4a5285e0f56376b8b3ce92c7361bb59e6eeb2d
|
FROM mobylinux/alpine-build-go@sha256:1eca9f912cfa4f59ad817acad76744516b999395c080bc01a50b3a2b3a9a3f5c
|
||||||
|
|
||||||
COPY ./ /go/src/diagnostics-server/
|
COPY ./ /go/src/diagnostics-server/
|
||||||
|
|
||||||
WORKDIR /go/src/diagnostics-server
|
WORKDIR /go/src/diagnostics-server
|
||||||
|
|
||||||
|
RUN lint.sh .
|
||||||
|
|
||||||
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
||||||
|
|
||||||
CMD ["tar", "cf", "-", "-C", "/go/bin", "diagnostics-server"]
|
CMD ["tar", "cf", "-", "-C", "/go/bin", "diagnostics-server"]
|
||||||
|
@ -82,12 +82,15 @@ type Capturer interface {
|
|||||||
Capture(context.Context, *tar.Writer)
|
Capture(context.Context, *tar.Writer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CommandCapturer describes commands with its arguments and timeout to
|
||||||
|
// capture diagnostic information from
|
||||||
type CommandCapturer struct {
|
type CommandCapturer struct {
|
||||||
command string
|
command string
|
||||||
args []string
|
args []string
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Capture writes output from a CommandCapturer to a tar archive
|
||||||
func (cc CommandCapturer) Capture(parentCtx context.Context, w *tar.Writer) {
|
func (cc CommandCapturer) Capture(parentCtx context.Context, w *tar.Writer) {
|
||||||
stdout := &bytes.Buffer{}
|
stdout := &bytes.Buffer{}
|
||||||
stderr := &bytes.Buffer{}
|
stderr := &bytes.Buffer{}
|
||||||
@ -148,10 +151,14 @@ func runCmd(cmd *exec.Cmd, done chan<- struct{}) {
|
|||||||
done <- struct{}{}
|
done <- struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DatabaseCapturer defines behavior for capturing diagnostic
|
||||||
|
// information from dumping a database
|
||||||
type DatabaseCapturer struct {
|
type DatabaseCapturer struct {
|
||||||
*CommandCapturer
|
*CommandCapturer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewDatabaseCapturer creates a new DatabaseCapturer that cats
|
||||||
|
// the database's contents to a CommandCapturer
|
||||||
func NewDatabaseCapturer() DatabaseCapturer {
|
func NewDatabaseCapturer() DatabaseCapturer {
|
||||||
return DatabaseCapturer{
|
return DatabaseCapturer{
|
||||||
&CommandCapturer{
|
&CommandCapturer{
|
||||||
@ -161,6 +168,7 @@ func NewDatabaseCapturer() DatabaseCapturer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Capture writes output from a DatabaseCapturer to a tar archive
|
||||||
func (dc DatabaseCapturer) Capture(parentCtx context.Context, w *tar.Writer) {
|
func (dc DatabaseCapturer) Capture(parentCtx context.Context, w *tar.Writer) {
|
||||||
// Dump the database
|
// Dump the database
|
||||||
dbBase := "/Database/branch/master/ro"
|
dbBase := "/Database/branch/master/ro"
|
||||||
|
@ -36,6 +36,7 @@ func init() {
|
|||||||
// for cloud editions.
|
// for cloud editions.
|
||||||
type HTTPDiagnosticListener struct{}
|
type HTTPDiagnosticListener struct{}
|
||||||
|
|
||||||
|
// Listen starts the HTTPDiagnosticListener and sets up handlers for its endpoints
|
||||||
func (h HTTPDiagnosticListener) Listen() {
|
func (h HTTPDiagnosticListener) Listen() {
|
||||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := os.Stat(dockerSock); os.IsNotExist(err) {
|
if _, err := os.Stat(dockerSock); os.IsNotExist(err) {
|
||||||
@ -140,10 +141,8 @@ func (h HTTPDiagnosticListener) Listen() {
|
|||||||
}
|
}
|
||||||
log.Println(string(body))
|
log.Println(string(body))
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
log.Println("No error sending S3 request")
|
|
||||||
}
|
}
|
||||||
|
log.Println("No error sending S3 request")
|
||||||
log.Println("Diagnostics request finished")
|
log.Println("Diagnostics request finished")
|
||||||
}()
|
}()
|
||||||
})
|
})
|
||||||
|
@ -7,8 +7,10 @@ import (
|
|||||||
"github.com/rneugeba/virtsock/go/hvsock"
|
"github.com/rneugeba/virtsock/go/hvsock"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// HVSockDiagnosticListener is a diagnostic server using HVSock (Windows)
|
||||||
type HVSockDiagnosticListener struct{}
|
type HVSockDiagnosticListener struct{}
|
||||||
|
|
||||||
|
// Listen sets up the diagnostic server to listen on an HVSock
|
||||||
func (l HVSockDiagnosticListener) Listen() {
|
func (l HVSockDiagnosticListener) Listen() {
|
||||||
svcid, _ := hvsock.GuidFromString("445BA2CB-E69B-4912-8B42-D7F494D007EA")
|
svcid, _ := hvsock.GuidFromString("445BA2CB-E69B-4912-8B42-D7F494D007EA")
|
||||||
hvsock, err := hvsock.Listen(hvsock.HypervAddr{VmId: hvsock.GUID_WILDCARD, ServiceId: svcid})
|
hvsock, err := hvsock.Listen(hvsock.HypervAddr{VmId: hvsock.GUID_WILDCARD, ServiceId: svcid})
|
||||||
|
@ -16,6 +16,7 @@ func init() {
|
|||||||
log.SetFlags(0)
|
log.SetFlags(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DiagnosticListener listens for starting diagnostics capture requests
|
||||||
type DiagnosticListener interface {
|
type DiagnosticListener interface {
|
||||||
// Listen(), a blocking method intended to be invoked in its own
|
// Listen(), a blocking method intended to be invoked in its own
|
||||||
// goroutine, will listen for a diagnostic information request and
|
// goroutine, will listen for a diagnostic information request and
|
||||||
|
@ -5,8 +5,10 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// RawTCPDiagnosticListener is a diagnostic server listening on a TCP port
|
||||||
type RawTCPDiagnosticListener struct{}
|
type RawTCPDiagnosticListener struct{}
|
||||||
|
|
||||||
|
// Listen for RawTCPDiagnosticListener listens on port 62374
|
||||||
func (l RawTCPDiagnosticListener) Listen() {
|
func (l RawTCPDiagnosticListener) Listen() {
|
||||||
ip, err := net.Listen("tcp", ":62374")
|
ip, err := net.Listen("tcp", ":62374")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -7,8 +7,10 @@ import (
|
|||||||
"github.com/rneugeba/virtsock/go/vsock"
|
"github.com/rneugeba/virtsock/go/vsock"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// VSockDiagnosticListener is a diagnostic server listening on VSock
|
||||||
type VSockDiagnosticListener struct{}
|
type VSockDiagnosticListener struct{}
|
||||||
|
|
||||||
|
// Listen for VSockDiagnosticListener listens on a VSock's port 62374
|
||||||
func (l VSockDiagnosticListener) Listen() {
|
func (l VSockDiagnosticListener) Listen() {
|
||||||
vsock, err := vsock.Listen(uint(62374))
|
vsock, err := vsock.Listen(uint(62374))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
# Tag: 1ae7bf8ec49a6537a93fba0c90720c65fa1c6ece
|
# Tag: d3f266a146a79f35d3bebf252cce62eee25fcfa9
|
||||||
FROM mobylinux/alpine-build-go@sha256:5e9aed92363c25349c2845b9be4a5285e0f56376b8b3ce92c7361bb59e6eeb2d
|
FROM mobylinux/alpine-build-go@sha256:1eca9f912cfa4f59ad817acad76744516b999395c080bc01a50b3a2b3a9a3f5c
|
||||||
|
|
||||||
COPY ./ /go/src/proxy/
|
COPY ./ /go/src/proxy/
|
||||||
|
|
||||||
WORKDIR /go/src/proxy
|
WORKDIR /go/src/proxy
|
||||||
|
|
||||||
|
RUN lint.sh .
|
||||||
|
|
||||||
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
||||||
|
|
||||||
CMD ["tar", "cf", "-", "-C", "/go/bin", "proxy"]
|
CMD ["tar", "cf", "-", "-C", "/go/bin", "proxy"]
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
// Package proxy provides a network Proxy interface and implementations for TCP
|
// Package libproxy provides a network Proxy interface and implementations for TCP
|
||||||
// and UDP.
|
// and UDP.
|
||||||
package libproxy
|
package libproxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/rneugeba/virtsock/go/vsock"
|
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
|
"github.com/rneugeba/virtsock/go/vsock"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Proxy defines the behavior of a proxy. It forwards traffic back and forth
|
// Proxy defines the behavior of a proxy. It forwards traffic back and forth
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Conn defines a network connection
|
||||||
type Conn interface {
|
type Conn interface {
|
||||||
io.Reader
|
io.Reader
|
||||||
io.Writer
|
io.Writer
|
||||||
@ -33,6 +34,7 @@ func NewTCPProxy(listener net.Listener, backendAddr *net.TCPAddr) (*TCPProxy, er
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HandleTCPConnection forwards the TCP traffic to a specified backend address
|
||||||
func HandleTCPConnection(client Conn, backendAddr *net.TCPAddr, quit chan bool) {
|
func HandleTCPConnection(client Conn, backendAddr *net.TCPAddr, quit chan bool) {
|
||||||
backend, err := net.DialTCP("tcp", nil, backendAddr)
|
backend, err := net.DialTCP("tcp", nil, backendAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -9,12 +9,14 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
type udpListener interface {
|
// UDPListener defines a listener interface to read, write and close a UDP connection
|
||||||
|
type UDPListener interface {
|
||||||
ReadFromUDP(b []byte) (int, *net.UDPAddr, error)
|
ReadFromUDP(b []byte) (int, *net.UDPAddr, error)
|
||||||
WriteToUDP(b []byte, addr *net.UDPAddr) (int, error)
|
WriteToUDP(b []byte, addr *net.UDPAddr) (int, error)
|
||||||
Close() error
|
Close() error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// udpEncapsulator encapsulates a UDP connection and listener
|
||||||
type udpEncapsulator struct {
|
type udpEncapsulator struct {
|
||||||
conn *net.Conn
|
conn *net.Conn
|
||||||
listener net.Listener
|
listener net.Listener
|
||||||
@ -38,6 +40,8 @@ func (u *udpEncapsulator) getConn() (net.Conn, error) {
|
|||||||
return conn, nil
|
return conn, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReadFromUDP reads the bytestream from a udpEncapsulator, returning the
|
||||||
|
// number of bytes read and the unpacked UDPAddr struct
|
||||||
func (u *udpEncapsulator) ReadFromUDP(b []byte) (int, *net.UDPAddr, error) {
|
func (u *udpEncapsulator) ReadFromUDP(b []byte) (int, *net.UDPAddr, error) {
|
||||||
conn, err := u.getConn()
|
conn, err := u.getConn()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -54,6 +58,8 @@ func (u *udpEncapsulator) ReadFromUDP(b []byte) (int, *net.UDPAddr, error) {
|
|||||||
return length, &udpAddr, nil
|
return length, &udpAddr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WriteToUDP writes a bytestream to a specified UDPAddr, returning the number
|
||||||
|
// of bytes successfully written
|
||||||
func (u *udpEncapsulator) WriteToUDP(b []byte, addr *net.UDPAddr) (int, error) {
|
func (u *udpEncapsulator) WriteToUDP(b []byte, addr *net.UDPAddr) (int, error) {
|
||||||
conn, err := u.getConn()
|
conn, err := u.getConn()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -65,6 +71,7 @@ func (u *udpEncapsulator) WriteToUDP(b []byte, addr *net.UDPAddr) (int, error) {
|
|||||||
return len(b), datagram.Marshal(conn)
|
return len(b), datagram.Marshal(conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close closes the connection in the udpEncapsulator
|
||||||
func (u *udpEncapsulator) Close() error {
|
func (u *udpEncapsulator) Close() error {
|
||||||
if u.conn != nil {
|
if u.conn != nil {
|
||||||
conn := *u.conn
|
conn := *u.conn
|
||||||
@ -74,7 +81,8 @@ func (u *udpEncapsulator) Close() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUDPConn(conn net.Conn) udpListener {
|
// NewUDPConn initializes a new UDP connection
|
||||||
|
func NewUDPConn(conn net.Conn) UDPListener {
|
||||||
var m sync.Mutex
|
var m sync.Mutex
|
||||||
var r sync.Mutex
|
var r sync.Mutex
|
||||||
var w sync.Mutex
|
var w sync.Mutex
|
||||||
@ -87,7 +95,8 @@ func NewUDPConn(conn net.Conn) udpListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUDPListener(listener net.Listener) udpListener {
|
// NewUDPListener initializes a new UDP listener
|
||||||
|
func NewUDPListener(listener net.Listener) UDPListener {
|
||||||
var m sync.Mutex
|
var m sync.Mutex
|
||||||
var r sync.Mutex
|
var r sync.Mutex
|
||||||
var w sync.Mutex
|
var w sync.Mutex
|
||||||
@ -107,6 +116,7 @@ type udpDatagram struct {
|
|||||||
Zone string
|
Zone string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Marshal marshals data from the udpDatagram to the provided connection
|
||||||
func (u *udpDatagram) Marshal(conn net.Conn) error {
|
func (u *udpDatagram) Marshal(conn net.Conn) error {
|
||||||
// marshal the variable length header to a temporary buffer
|
// marshal the variable length header to a temporary buffer
|
||||||
var header bytes.Buffer
|
var header bytes.Buffer
|
||||||
@ -154,6 +164,7 @@ func (u *udpDatagram) Marshal(conn net.Conn) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unmarshal unmarshals data from the connection to the udpDatagram
|
||||||
func (u *udpDatagram) Unmarshal(conn net.Conn) (int, error) {
|
func (u *udpDatagram) Unmarshal(conn net.Conn) (int, error) {
|
||||||
var length uint16
|
var length uint16
|
||||||
// frame length
|
// frame length
|
||||||
|
@ -46,7 +46,7 @@ type connTrackMap map[connTrackKey]*net.UDPConn
|
|||||||
// interface to handle UDP traffic forwarding between the frontend and backend
|
// interface to handle UDP traffic forwarding between the frontend and backend
|
||||||
// addresses.
|
// addresses.
|
||||||
type UDPProxy struct {
|
type UDPProxy struct {
|
||||||
listener udpListener
|
listener UDPListener
|
||||||
frontendAddr net.Addr
|
frontendAddr net.Addr
|
||||||
backendAddr *net.UDPAddr
|
backendAddr *net.UDPAddr
|
||||||
connTrackTable connTrackMap
|
connTrackTable connTrackMap
|
||||||
@ -54,7 +54,7 @@ type UDPProxy struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewUDPProxy creates a new UDPProxy.
|
// NewUDPProxy creates a new UDPProxy.
|
||||||
func NewUDPProxy(frontendAddr net.Addr, listener udpListener, backendAddr *net.UDPAddr) (*UDPProxy, error) {
|
func NewUDPProxy(frontendAddr net.Addr, listener UDPListener, backendAddr *net.UDPAddr) (*UDPProxy, error) {
|
||||||
|
|
||||||
return &UDPProxy{
|
return &UDPProxy{
|
||||||
listener: listener,
|
listener: listener,
|
||||||
|
@ -3,18 +3,19 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"flag"
|
"flag"
|
||||||
"github.com/rneugeba/virtsock/go/hvsock"
|
|
||||||
"github.com/rneugeba/virtsock/go/vsock"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"proxy/libproxy"
|
"proxy/libproxy"
|
||||||
|
|
||||||
|
"github.com/rneugeba/virtsock/go/hvsock"
|
||||||
|
"github.com/rneugeba/virtsock/go/vsock"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Listen on virtio-vsock and AF_HYPERV for multiplexed connections
|
// Listen on virtio-vsock and AF_HYPERV for multiplexed connections
|
||||||
func manyPorts() {
|
func manyPorts() {
|
||||||
var (
|
var (
|
||||||
vsockPort = flag.Int("vsockPort", 62373, "virtio-vsock port")
|
vsockPort = flag.Int("vsockPort", 62373, "virtio-vsock port")
|
||||||
hvGuid = flag.String("hvGuid", "0B95756A-9985-48AD-9470-78E060895BE7", "Hyper-V service GUID")
|
hvGUID = flag.String("hvGuid", "0B95756A-9985-48AD-9470-78E060895BE7", "Hyper-V service GUID")
|
||||||
)
|
)
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@ -26,10 +27,10 @@ func manyPorts() {
|
|||||||
} else {
|
} else {
|
||||||
listeners = append(listeners, vsock)
|
listeners = append(listeners, vsock)
|
||||||
}
|
}
|
||||||
svcid, _ := hvsock.GuidFromString(*hvGuid)
|
svcid, _ := hvsock.GuidFromString(*hvGUID)
|
||||||
hvsock, err := hvsock.Listen(hvsock.HypervAddr{VmId: hvsock.GUID_WILDCARD, ServiceId: svcid})
|
hvsock, err := hvsock.Listen(hvsock.HypervAddr{VmId: hvsock.GUID_WILDCARD, ServiceId: svcid})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to bind hvsock guid: %s: %#v", *hvGuid, err)
|
log.Printf("Failed to bind hvsock guid: %s: %#v", *hvGUID, err)
|
||||||
} else {
|
} else {
|
||||||
listeners = append(listeners, hvsock)
|
listeners = append(listeners, hvsock)
|
||||||
}
|
}
|
||||||
@ -83,7 +84,9 @@ func manyPorts() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// TCP protocol const
|
||||||
TCP = 1
|
TCP = 1
|
||||||
|
// UDP protocol const
|
||||||
UDP = 2
|
UDP = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
# Tag: 1ae7bf8ec49a6537a93fba0c90720c65fa1c6ece
|
# Tag: d3f266a146a79f35d3bebf252cce62eee25fcfa9
|
||||||
FROM mobylinux/alpine-build-go@sha256:5e9aed92363c25349c2845b9be4a5285e0f56376b8b3ce92c7361bb59e6eeb2d
|
FROM mobylinux/alpine-build-go@sha256:1eca9f912cfa4f59ad817acad76744516b999395c080bc01a50b3a2b3a9a3f5c
|
||||||
|
|
||||||
COPY ./ /go/src/vsudd/
|
COPY ./ /go/src/vsudd/
|
||||||
|
|
||||||
WORKDIR /go/src/vsudd
|
WORKDIR /go/src/vsudd
|
||||||
|
|
||||||
|
RUN lint.sh .
|
||||||
|
|
||||||
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
RUN go install --ldflags '-extldflags "-fno-PIC"'
|
||||||
|
|
||||||
CMD ["tar", "cf", "-", "-C", "/go/bin", "vsudd"]
|
CMD ["tar", "cf", "-", "-C", "/go/bin", "vsudd"]
|
||||||
|
@ -188,7 +188,7 @@ func handleOneIn(connid int, conn vConn, sock string) {
|
|||||||
var docker *net.UnixConn
|
var docker *net.UnixConn
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
docker, err = net.DialUnix("unix", nil, &net.UnixAddr{sock, "unix"})
|
docker, err = net.DialUnix("unix", nil, &net.UnixAddr{Name: sock, Net: "unix"})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// If the forwarding program has broken then close and continue
|
// If the forwarding program has broken then close and continue
|
||||||
|
@ -158,7 +158,7 @@ func handleSyslogForward(cfg string) {
|
|||||||
/* Try and carry on... */
|
/* Try and carry on... */
|
||||||
}
|
}
|
||||||
|
|
||||||
l, err := net.ListenUnixgram("unixgram", &net.UnixAddr{usock, "unixgram"})
|
l, err := net.ListenUnixgram("unixgram", &net.UnixAddr{Name: usock, Net: "unixgram"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
console.Fatalf("Failed to listen to unixgram:%s: %s", usock, err)
|
console.Fatalf("Failed to listen to unixgram:%s: %s", usock, err)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Will do a Go build in future
|
# Will do a Go build in future
|
||||||
# Tag: 1ae7bf8ec49a6537a93fba0c90720c65fa1c6ece
|
# Tag: d3f266a146a79f35d3bebf252cce62eee25fcfa9
|
||||||
FROM mobylinux/alpine-build-go@sha256:5e9aed92363c25349c2845b9be4a5285e0f56376b8b3ce92c7361bb59e6eeb2d
|
FROM mobylinux/alpine-build-go@sha256:1eca9f912cfa4f59ad817acad76744516b999395c080bc01a50b3a2b3a9a3f5c
|
||||||
|
|
||||||
COPY test.sh mksh /tmp/bin/
|
COPY test.sh mksh /tmp/bin/
|
||||||
COPY ca-certificates.crt /tmp/etc/ssl/certs/ca-certificates.crt
|
COPY ca-certificates.crt /tmp/etc/ssl/certs/ca-certificates.crt
|
||||||
|
Loading…
Reference in New Issue
Block a user