add control wrapper
parent
1dd7340d4b
commit
ab0c867aa1
@ -0,0 +1,21 @@
|
||||
# Dockerfile.protogen
|
||||
FROM golang:latest
|
||||
|
||||
LABEL maintainer="Benjamin Grewell <bgrewell@gmail.com>"
|
||||
|
||||
ENV PROTOC_VERSION 3.6.1
|
||||
ENV PROTOC_GEN_GO_VERSION v1.2.0
|
||||
|
||||
WORKDIR /go/src/github.com/BGrewell/go-iperf/api/proto
|
||||
|
||||
RUN apt update
|
||||
RUN apt install -y protobuf-compiler python3 python3-pip
|
||||
RUN go get -u github.com/golang/protobuf/protoc-gen-go
|
||||
RUN pip3 install grpcio-tools
|
||||
RUN export PATH=$PATH:$GOPATH/bin
|
||||
RUN echo $PATH
|
||||
|
||||
COPY proto/control.proto control.proto
|
||||
|
||||
RUN mkdir go
|
||||
RUN protoc -I /. --go_out=plugins=grpc:go control.proto
|
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -d go ]; then
|
||||
echo "[!] Creating go output directory"
|
||||
mkdir go;
|
||||
fi
|
||||
|
||||
echo "[+] Building docker container"
|
||||
docker image build -t go-iperf-builder:1.0 .
|
||||
docker container run --detach --name builder go-iperf-builder:1.0
|
||||
docker cp grpc:/go/src/github.com/BGrewell/go-iperf/api/go/api.pb.go go/.
|
||||
echo "[+] Updating of go library complete"
|
||||
|
||||
echo "[+] Removing docker container"
|
||||
docker rm builder
|
||||
|
||||
echo "[+] Adding new files to source control"
|
||||
git add go/api.pb.go
|
||||
git commit -m "regenerated grpc libraries"
|
||||
git push
|
||||
|
||||
echo "[+] Done. Everything has been rebuilt and the repository has been updated and pushed"
|
@ -0,0 +1,27 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
// [START java_declaration]
|
||||
option java_multiple_files = true;
|
||||
option java_package = "com.bengrewell.go-iperf.control";
|
||||
option java_outer_classname = "Control";
|
||||
// [END java_declaration]
|
||||
|
||||
// [START csharp_declaration]
|
||||
option csharp_namespace = "BenGrewell.GoIperf.Control";
|
||||
// [END csharp_declaration]
|
||||
|
||||
package api;
|
||||
|
||||
service Command {
|
||||
rpc StartServer(StartServerRequest) returns (StartServerResponse) {}
|
||||
}
|
||||
|
||||
message StartServerRequest {
|
||||
}
|
||||
|
||||
message StartServerResponse {
|
||||
string id = 1;
|
||||
int32 listen_port = 2;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package iperf
|
||||
|
||||
type Controller struct {
|
||||
clients map[string]*Client
|
||||
servers map[string]*Server
|
||||
}
|
||||
|
||||
func (c *Controller) StartListener() (err error) {
|
||||
|
||||
}
|
||||
|
||||
func (c *Controller) StopListener() (err error) {
|
||||
|
||||
}
|
||||
|
||||
func (c *Controller) StopServer(id string) (err error) {
|
||||
|
||||
}
|
||||
|
||||
func (c *Controller) NewServer() (server *Server, err error) {
|
||||
|
||||
}
|
||||
|
||||
func (c *Controller) NewClient(serverAddr string) (client *Client, err error) {
|
||||
|
||||
}
|
Loading…
Reference in New Issue