Add grpc service to shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
e6de7ea4b5
commit
c08e0e610c
8 changed files with 402 additions and 229 deletions
19
utils/socket.go
Normal file
19
utils/socket.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// CreateUnixSocket creates a unix socket and returns the listener
|
||||
func CreateUnixSocket(path string) (net.Listener, error) {
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0660); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) {
|
||||
return nil, err
|
||||
}
|
||||
return net.Listen("unix", path)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue