| // Copyright 2017 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // A Conn represents a raw connection. |
| // NewConn returns a new raw connection. |
| func NewConn(c net.Conn) (*Conn, error) { |
| cc.c, err = c.SyscallConn() |
| cc.c, err = c.SyscallConn() |
| cc.c, err = c.SyscallConn() |
| return nil, errors.New("unknown connection type") |
| func (o *Option) get(c *Conn, b []byte) (int, error) { |
| n, operr = getsockopt(s, o.Level, o.Name, b) |
| if err := c.c.Control(fn); err != nil { |
| return n, os.NewSyscallError("getsockopt", operr) |
| func (o *Option) set(c *Conn, b []byte) error { |
| operr = setsockopt(s, o.Level, o.Name, b) |
| if err := c.c.Control(fn); err != nil { |
| return os.NewSyscallError("setsockopt", operr) |