github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/network/port.go (about)

     1  // Copyright 2013 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package network
     5  
     6  import (
     7  	"fmt"
     8  )
     9  
    10  // Port identifies a network port number for a particular protocol.
    11  //
    12  // NOTE(dimitern): This is deprecated and should be removed, use
    13  // PortRange instead. There are a few places which still use Port,
    14  // especially in apiserver/params, so it can't be removed yet.
    15  type Port struct {
    16  	Protocol string
    17  	Number   int
    18  }
    19  
    20  // String implements Stringer.
    21  func (p Port) String() string {
    22  	return fmt.Sprintf("%d/%s", p.Number, p.Protocol)
    23  }
    24  
    25  // GoString implements fmt.GoStringer.
    26  func (p Port) GoString() string {
    27  	return p.String()
    28  }