MCPcopy
hub / github.com/istio/istio / Start

Method Start

pkg/test/echo/server/instance.go:105–144  ·  view source on GitHub ↗

Start the server.

()

Source from the content-addressed store, hash-verified

103
104// Start the server.
105func (s *Instance) Start() (err error) {
106 defer func() {
107 if err != nil {
108 _ = s.Close()
109 }
110 }()
111
112 if err = s.validate(); err != nil {
113 return err
114 }
115
116 if s.Metrics > 0 {
117 go s.startMetricsServer()
118 }
119 s.endpoints = make([]endpoint.Instance, 0)
120
121 for _, p := range s.Ports {
122 ips, err := s.getListenerIPs(p)
123 if err != nil {
124 return err
125 }
126 for _, ip := range getBindAddresses(ips) {
127 ep, err := s.newEndpoint(p, ip, "")
128 if err != nil {
129 return err
130 }
131 s.endpoints = append(s.endpoints, ep)
132 }
133 }
134
135 if len(s.UDSServer) > 0 {
136 ep, err := s.newEndpoint(nil, "", s.UDSServer)
137 if err != nil {
138 return err
139 }
140 s.endpoints = append(s.endpoints, ep)
141 }
142
143 return s.waitUntilReady()
144}
145
146func getBindAddresses(ip []string) []string {
147 localhost := len(ip) == 1 && ip[0] == "localhost"

Callers

nothing calls this directly

Calls 7

CloseMethod · 0.95
validateMethod · 0.95
startMetricsServerMethod · 0.95
getListenerIPsMethod · 0.95
newEndpointMethod · 0.95
waitUntilReadyMethod · 0.95
getBindAddressesFunction · 0.85

Tested by

no test coverage detected