1// +build go1.9 2 3/* 4 * 5 * Copyright 2018 gRPC authors. 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * 19 */ 20 21package credentials 22 23import ( 24 "crypto/tls" 25 "errors" 26 "net" 27 "syscall" 28) 29 30type tlsConn struct { 31 *tls.Conn 32 rawConn net.Conn 33} 34 35// implements the syscall.Conn interface 36func (c tlsConn) SyscallConn() (syscall.RawConn, error) { 37 conn, ok := c.rawConn.(syscall.Conn) 38 if !ok { 39 return nil, errors.New("RawConn does not implement syscall.Conn") 40 } 41 return conn.SyscallConn() 42} 43