go.nanomsg.org/mangos/v3@v3.4.3-0.20240217232803-46464076f1f5/transport/connipc.go (about)

     1  // Copyright 2020 The Mangos Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use 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 implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package transport
    16  
    17  import (
    18  	"net"
    19  
    20  	"go.nanomsg.org/mangos/v3"
    21  )
    22  
    23  // NewConnPipeIPC allocates a new Pipe using the IPC exchange protocol.
    24  func NewConnPipeIPC(c net.Conn, proto ProtocolInfo) ConnPipe {
    25  	p := &connipc{
    26  		conn: conn{
    27  			c:       c,
    28  			proto:   proto,
    29  			options: make(map[string]interface{}),
    30  			maxrx:   0,
    31  		},
    32  	}
    33  	p.options[mangos.OptionMaxRecvSize] = 0
    34  	p.options[mangos.OptionLocalAddr] = c.LocalAddr()
    35  	p.options[mangos.OptionRemoteAddr] = c.RemoteAddr()
    36  	return p
    37  }