...
Source file
src/net/file.go
Documentation: net
1
2
3
4
5 package net
6
7 import "os"
8
9
10
11
12 type fileAddr string
13
14 func (fileAddr) Network() string { return "file+net" }
15 func (f fileAddr) String() string { return string(f) }
16
17
18
19
20
21 func FileConn(f *os.File) (c Conn, err error) {
22 c, err = fileConn(f)
23 if err != nil {
24 err = &OpError{Op: "file", Net: "file+net", Source: nil, Addr: fileAddr(f.Name()), Err: err}
25 }
26 return
27 }
28
29
30
31
32
33 func FileListener(f *os.File) (ln Listener, err error) {
34 ln, err = fileListener(f)
35 if err != nil {
36 err = &OpError{Op: "file", Net: "file+net", Source: nil, Addr: fileAddr(f.Name()), Err: err}
37 }
38 return
39 }
40
41
42
43
44
45 func FilePacketConn(f *os.File) (c PacketConn, err error) {
46 c, err = filePacketConn(f)
47 if err != nil {
48 err = &OpError{Op: "file", Net: "file+net", Source: nil, Addr: fileAddr(f.Name()), Err: err}
49 }
50 return
51 }
52
View as plain text