Docker go-plugin-helper network implementation
To get this repo
go get github.com/tugbadartici/docker-network-plugin
Docker network plugin uses a network driver file which is located on "/etc/docker/plugins/". If this dir does not exist create it.
1- Create a json file on this location & give an empty port
{
"Name": "mynetwork",
"Addr": "tcp://127.0.0.1:8010"
}
2- Example usage of mydriver package with golang is like this. You need to pass the port as parameter to Handle function.
package main
import (
"github.com/tugbadartici/docker-network-plugin"
"github.com/docker/go-plugins-helpers/network"
)
func main() {
d := mydriver.NewDriver()
h := network.NewHandler(d)
h.ServeTCP("test", ":8010", nil)
}