(async bool)
| 157 | } |
| 158 | |
| 159 | func (d *Dataplane) GetProxyServer(async bool) (proxy.Proxy, error) { |
| 160 | cpApi, err := grpc_helpers.NewControlPlaneConnection(d.config.ControlPlaneAddress) |
| 161 | if err != nil { |
| 162 | return nil, err |
| 163 | } |
| 164 | |
| 165 | err = d.registerDataPlane(cpApi) |
| 166 | if err != nil { |
| 167 | return nil, err |
| 168 | } |
| 169 | |
| 170 | err = d.syncDeploymentCache(&cpApi, d.deployments) |
| 171 | if err != nil { |
| 172 | return nil, err |
| 173 | } |
| 174 | |
| 175 | loadBalancingPolicy := d.parseLoadBalancingPolicy(d.config) |
| 176 | |
| 177 | if !async { |
| 178 | return proxy.NewProxyingService( |
| 179 | d.config.PortProxy, |
| 180 | d.deployments, |
| 181 | cpApi, |
| 182 | path.Join(d.config.TraceOutputFolder, "proxy_trace.csv"), |
| 183 | loadBalancingPolicy, |
| 184 | ), nil |
| 185 | } else { |
| 186 | return proxy.NewAsyncProxyingService( |
| 187 | d.config, |
| 188 | d.deployments, |
| 189 | cpApi, |
| 190 | path.Join(d.config.TraceOutputFolder, "proxy_trace.csv"), |
| 191 | loadBalancingPolicy, |
| 192 | ), nil |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | func (d *Dataplane) DeregisterControlPlaneConnection() { |
| 197 | err := grpc_helpers.DeregisterControlPlaneConnection(&d.config) |
no test coverage detected