| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package streamclient |
| 6 |
| 7 import ( |
| 8 "errors" |
| 9 "fmt" |
| 10 "io" |
| 11 |
| 12 npipe "gopkg.in/natefinch/npipe.v2" |
| 13 ) |
| 14 |
| 15 // Register POSIX-only protocols. |
| 16 func init() { |
| 17 registerProtocol("net.pipe", newNamedPipeClient) |
| 18 } |
| 19 |
| 20 // newNamedPipeClient creates a new Client instance bound to a named pipe stream |
| 21 // server. |
| 22 func newNamedPipeClient(path string) (Client, error) { |
| 23 if path == "" { |
| 24 return nil, errors.New("streamclient: cannot have empty named pi
pe path") |
| 25 } |
| 26 |
| 27 return &clientImpl{func() (io.WriteCloser, error) { |
| 28 return npipe.Dial(fmt.Sprintf(`\\.\pipe\%s`, path)) |
| 29 }}, nil |
| 30 } |
| OLD | NEW |