github.com/osrg/gobgp/v3@v3.30.0/pkg/server/sockopt_darwin.go (about) 1 // Copyright (C) 2016-2017 Nippon Telegraph and Telephone Corporation. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 // implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 //go:build darwin 16 // +build darwin 17 18 package server 19 20 import ( 21 "fmt" 22 "net" 23 "strings" 24 "syscall" 25 ) 26 27 func setTcpMD5SigSockopt(l *net.TCPListener, address string, key string) error { 28 return fmt.Errorf("setting md5 is not supported") 29 } 30 31 func setTcpTTLSockopt(conn *net.TCPConn, ttl int) error { 32 family := syscall.AF_INET 33 if strings.Contains(conn.RemoteAddr().String(), "[") { 34 family = syscall.AF_INET6 35 } 36 sc, err := conn.SyscallConn() 37 if err != nil { 38 return err 39 } 40 return setsockoptIpTtl(sc, family, ttl) 41 } 42 43 func setTcpMinTTLSockopt(conn *net.TCPConn, ttl int) error { 44 return fmt.Errorf("setting min ttl is not supported") 45 } 46 47 func setTcpMSSSockopt(conn *net.TCPConn, mss uint16) error { 48 family := extractFamilyFromTCPConn(conn) 49 sc, err := conn.SyscallConn() 50 if err != nil { 51 return err 52 } 53 return setsockoptTcpMss(sc, family, mss) 54 }