Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -117,9 +117,9 @@ func (d *driver) NetworkAllocate(id string, option map[string]string, ipV4Data, |
| 117 | 117 |
n.subnets = append(n.subnets, s) |
| 118 | 118 |
} |
| 119 | 119 |
|
| 120 |
- val := fmt.Sprintf("%d", n.subnets[0].vni)
|
|
| 120 |
+ val := strconv.FormatUint(uint64(n.subnets[0].vni), 10) |
|
| 121 | 121 |
for _, s := range n.subnets[1:] {
|
| 122 |
- val = val + fmt.Sprintf(",%d", s.vni)
|
|
| 122 |
+ val = val + "," + strconv.FormatUint(uint64(s.vni), 10) |
|
| 123 | 123 |
} |
| 124 | 124 |
opts[netlabel.OverlayVxlanIDList] = val |
| 125 | 125 |
|
| ... | ... |
@@ -71,12 +71,12 @@ type hnsEndpoint struct {
|
| 71 | 71 |
nid string |
| 72 | 72 |
profileID string |
| 73 | 73 |
Type string |
| 74 |
- //Note: Currently, the sandboxID is the same as the containerID since windows does |
|
| 75 |
- //not expose the sandboxID. |
|
| 76 |
- //In the future, windows will support a proper sandboxID that is different |
|
| 77 |
- //than the containerID. |
|
| 78 |
- //Therefore, we are using sandboxID now, so that we won't have to change this code |
|
| 79 |
- //when windows properly supports a sandboxID. |
|
| 74 |
+ // Note: Currently, the sandboxID is the same as the containerID since windows does |
|
| 75 |
+ // not expose the sandboxID. |
|
| 76 |
+ // In the future, windows will support a proper sandboxID that is different |
|
| 77 |
+ // than the containerID. |
|
| 78 |
+ // Therefore, we are using sandboxID now, so that we won't have to change this code |
|
| 79 |
+ // when windows properly supports a sandboxID. |
|
| 80 | 80 |
sandboxID string |
| 81 | 81 |
macAddress net.HardwareAddr |
| 82 | 82 |
epOption *endpointOption // User specified parameters |
| ... | ... |
@@ -377,8 +377,8 @@ func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo d
|
| 377 | 377 |
for i, subnet := range hnsresponse.Subnets {
|
| 378 | 378 |
var gwIP, subnetIP *net.IPNet |
| 379 | 379 |
|
| 380 |
- //The gateway returned from HNS is an IPAddress. |
|
| 381 |
- //We need to convert it to an IPNet to use as the Gateway of driverapi.IPAMData struct |
|
| 380 |
+ // The gateway returned from HNS is an IPAddress. |
|
| 381 |
+ // We need to convert it to an IPNet to use as the Gateway of driverapi.IPAMData struct |
|
| 382 | 382 |
gwCIDR := subnet.GatewayAddress + "/32" |
| 383 | 383 |
_, gwIP, err = net.ParseCIDR(gwCIDR) |
| 384 | 384 |
if err != nil {
|
| ... | ... |
@@ -61,7 +61,7 @@ func dbJoin(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| 61 | 61 |
diagnostic.HTTPReply(w, diagnostic.CommandSucceed(nil), json) |
| 62 | 62 |
return |
| 63 | 63 |
} |
| 64 |
- diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf("%s", dbNotAvailable)), json)
|
|
| 64 |
+ diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf(dbNotAvailable)), json) |
|
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 | 67 |
func dbPeers(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -95,7 +95,7 @@ func dbPeers(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| 95 | 95 |
diagnostic.HTTPReply(w, diagnostic.CommandSucceed(rsp), json) |
| 96 | 96 |
return |
| 97 | 97 |
} |
| 98 |
- diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf("%s", dbNotAvailable)), json)
|
|
| 98 |
+ diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf(dbNotAvailable)), json) |
|
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 | 101 |
func dbClusterPeers(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -118,7 +118,7 @@ func dbClusterPeers(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| 118 | 118 |
diagnostic.HTTPReply(w, diagnostic.CommandSucceed(rsp), json) |
| 119 | 119 |
return |
| 120 | 120 |
} |
| 121 |
- diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf("%s", dbNotAvailable)), json)
|
|
| 121 |
+ diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf(dbNotAvailable)), json) |
|
| 122 | 122 |
} |
| 123 | 123 |
|
| 124 | 124 |
func dbCreateEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -167,7 +167,7 @@ func dbCreateEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| 167 | 167 |
diagnostic.HTTPReply(w, diagnostic.CommandSucceed(nil), json) |
| 168 | 168 |
return |
| 169 | 169 |
} |
| 170 |
- diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf("%s", dbNotAvailable)), json)
|
|
| 170 |
+ diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf(dbNotAvailable)), json) |
|
| 171 | 171 |
} |
| 172 | 172 |
|
| 173 | 173 |
func dbUpdateEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -215,7 +215,7 @@ func dbUpdateEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| 215 | 215 |
diagnostic.HTTPReply(w, diagnostic.CommandSucceed(nil), json) |
| 216 | 216 |
return |
| 217 | 217 |
} |
| 218 |
- diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf("%s", dbNotAvailable)), json)
|
|
| 218 |
+ diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf(dbNotAvailable)), json) |
|
| 219 | 219 |
} |
| 220 | 220 |
|
| 221 | 221 |
func dbDeleteEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -252,7 +252,7 @@ func dbDeleteEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| 252 | 252 |
diagnostic.HTTPReply(w, diagnostic.CommandSucceed(nil), json) |
| 253 | 253 |
return |
| 254 | 254 |
} |
| 255 |
- diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf("%s", dbNotAvailable)), json)
|
|
| 255 |
+ diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf(dbNotAvailable)), json) |
|
| 256 | 256 |
} |
| 257 | 257 |
|
| 258 | 258 |
func dbGetEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -298,7 +298,7 @@ func dbGetEntry(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| 298 | 298 |
diagnostic.HTTPReply(w, diagnostic.CommandSucceed(rsp), json) |
| 299 | 299 |
return |
| 300 | 300 |
} |
| 301 |
- diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf("%s", dbNotAvailable)), json)
|
|
| 301 |
+ diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf(dbNotAvailable)), json) |
|
| 302 | 302 |
} |
| 303 | 303 |
|
| 304 | 304 |
func dbJoinNetwork(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -330,7 +330,7 @@ func dbJoinNetwork(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| 330 | 330 |
diagnostic.HTTPReply(w, diagnostic.CommandSucceed(nil), json) |
| 331 | 331 |
return |
| 332 | 332 |
} |
| 333 |
- diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf("%s", dbNotAvailable)), json)
|
|
| 333 |
+ diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf(dbNotAvailable)), json) |
|
| 334 | 334 |
} |
| 335 | 335 |
|
| 336 | 336 |
func dbLeaveNetwork(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -362,7 +362,7 @@ func dbLeaveNetwork(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| 362 | 362 |
diagnostic.HTTPReply(w, diagnostic.CommandSucceed(nil), json) |
| 363 | 363 |
return |
| 364 | 364 |
} |
| 365 |
- diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf("%s", dbNotAvailable)), json)
|
|
| 365 |
+ diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf(dbNotAvailable)), json) |
|
| 366 | 366 |
} |
| 367 | 367 |
|
| 368 | 368 |
func dbGetTable(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -410,7 +410,7 @@ func dbGetTable(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| 410 | 410 |
diagnostic.HTTPReply(w, diagnostic.CommandSucceed(rsp), json) |
| 411 | 411 |
return |
| 412 | 412 |
} |
| 413 |
- diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf("%s", dbNotAvailable)), json)
|
|
| 413 |
+ diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf(dbNotAvailable)), json) |
|
| 414 | 414 |
} |
| 415 | 415 |
|
| 416 | 416 |
func dbNetworkStats(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| ... | ... |
@@ -448,5 +448,5 @@ func dbNetworkStats(ctx interface{}, w http.ResponseWriter, r *http.Request) {
|
| 448 | 448 |
diagnostic.HTTPReply(w, rsp, json) |
| 449 | 449 |
return |
| 450 | 450 |
} |
| 451 |
- diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf("%s", dbNotAvailable)), json)
|
|
| 451 |
+ diagnostic.HTTPReply(w, diagnostic.FailCommand(fmt.Errorf(dbNotAvailable)), json) |
|
| 452 | 452 |
} |
| ... | ... |
@@ -600,7 +600,7 @@ func invokeFWMarker(path string, vip net.IP, fwMark uint32, ingressPorts []*Port |
| 600 | 600 |
|
| 601 | 601 |
cmd := &exec.Cmd{
|
| 602 | 602 |
Path: reexec.Self(), |
| 603 |
- Args: append([]string{"fwmarker"}, path, vip.String(), fmt.Sprintf("%d", fwMark), addDelOpt, ingressPortsFile, eIP.String(), lbMode),
|
|
| 603 |
+ Args: append([]string{"fwmarker"}, path, vip.String(), strconv.FormatUint(uint64(fwMark), 10), addDelOpt, ingressPortsFile, eIP.String(), lbMode),
|
|
| 604 | 604 |
Stdout: os.Stdout, |
| 605 | 605 |
Stderr: os.Stderr, |
| 606 | 606 |
} |
| ... | ... |
@@ -5,6 +5,7 @@ import ( |
| 5 | 5 |
"bytes" |
| 6 | 6 |
"fmt" |
| 7 | 7 |
"net" |
| 8 |
+ "strconv" |
|
| 8 | 9 |
"strings" |
| 9 | 10 |
|
| 10 | 11 |
"github.com/ishidawataru/sctp" |
| ... | ... |
@@ -202,7 +203,7 @@ func (p Protocol) String() string {
|
| 202 | 202 |
case SCTP: |
| 203 | 203 |
return "sctp" |
| 204 | 204 |
default: |
| 205 |
- return fmt.Sprintf("%d", p)
|
|
| 205 |
+ return strconv.Itoa(int(p)) |
|
| 206 | 206 |
} |
| 207 | 207 |
} |
| 208 | 208 |
|