mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
libnetwork/types: remove TransportPort.FromString() as it's unused
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
7c0d8fa5da
commit
073f8df0fe
2 changed files with 0 additions and 31 deletions
|
@ -5,7 +5,6 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/ishidawataru/sctp"
|
||||
|
@ -69,19 +68,6 @@ func (t *TransportPort) String() string {
|
|||
return fmt.Sprintf("%s/%d", t.Proto.String(), t.Port)
|
||||
}
|
||||
|
||||
// FromString reads the TransportPort structure from string
|
||||
func (t *TransportPort) FromString(s string) error {
|
||||
ps := strings.Split(s, "/")
|
||||
if len(ps) == 2 {
|
||||
t.Proto = ParseProtocol(ps[0])
|
||||
if p, err := strconv.ParseUint(ps[1], 10, 16); err == nil {
|
||||
t.Port = uint16(p)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return BadRequestErrorf("invalid format for transport port: %s", s)
|
||||
}
|
||||
|
||||
// PortBinding represents a port binding between the container and the host
|
||||
type PortBinding struct {
|
||||
Proto Protocol
|
||||
|
|
|
@ -5,23 +5,6 @@ import (
|
|||
"testing"
|
||||
)
|
||||
|
||||
func TestTransportPortConv(t *testing.T) {
|
||||
sform := "tcp/23"
|
||||
tp := &TransportPort{Proto: TCP, Port: uint16(23)}
|
||||
|
||||
if sform != tp.String() {
|
||||
t.Fatalf("String() method failed")
|
||||
}
|
||||
|
||||
rc := new(TransportPort)
|
||||
if err := rc.FromString(sform); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !tp.Equal(rc) {
|
||||
t.Fatalf("FromString() method failed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestErrorConstructors(t *testing.T) {
|
||||
var err error
|
||||
|
||||
|
|
Loading…
Reference in a new issue