()
| 259 | } |
| 260 | |
| 261 | func startV2Ray() (core.Server, error) { |
| 262 | |
| 263 | opts, err := parseEnv() |
| 264 | |
| 265 | if err == nil { |
| 266 | if c, b := opts.Get("mode"); b { |
| 267 | *mode = c |
| 268 | } |
| 269 | if c, b := opts.Get("mux"); b { |
| 270 | if i, err := strconv.Atoi(c); err == nil { |
| 271 | *mux = i |
| 272 | } else { |
| 273 | logWarn("failed to parse mux, use default value") |
| 274 | } |
| 275 | } |
| 276 | if _, b := opts.Get("tls"); b { |
| 277 | *tlsEnabled = true |
| 278 | } |
| 279 | if c, b := opts.Get("host"); b { |
| 280 | *host = c |
| 281 | } |
| 282 | if c, b := opts.Get("path"); b { |
| 283 | *path = c |
| 284 | } |
| 285 | if c, b := opts.Get("cert"); b { |
| 286 | *cert = c |
| 287 | } |
| 288 | if c, b := opts.Get("certRaw"); b { |
| 289 | *certRaw = c |
| 290 | } |
| 291 | if c, b := opts.Get("key"); b { |
| 292 | *key = c |
| 293 | } |
| 294 | if c, b := opts.Get("loglevel"); b { |
| 295 | *logLevel = c |
| 296 | } |
| 297 | if _, b := opts.Get("server"); b { |
| 298 | *server = true |
| 299 | } |
| 300 | if c, b := opts.Get("localAddr"); b { |
| 301 | if *server { |
| 302 | *remoteAddr = c |
| 303 | } else { |
| 304 | *localAddr = c |
| 305 | } |
| 306 | } |
| 307 | if c, b := opts.Get("localPort"); b { |
| 308 | if *server { |
| 309 | *remotePort = c |
| 310 | } else { |
| 311 | *localPort = c |
| 312 | } |
| 313 | } |
| 314 | if c, b := opts.Get("remoteAddr"); b { |
| 315 | if *server { |
| 316 | *localAddr = c |
| 317 | } else { |
| 318 | *remoteAddr = c |
no test coverage detected