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

     1  // Copyright 2015 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 mangos
    16  
    17  // Dialer is an interface to the underlying dialer for a transport
    18  // and address.
    19  type Dialer interface {
    20  	// Close closes the dialer, and removes it from any active socket.
    21  	// Further operations on the Dialer will return ErrClosed.
    22  	Close() error
    23  
    24  	// Dial starts connecting on the address.  If a connection fails,
    25  	// it will restart.
    26  	Dial() error
    27  
    28  	// Address returns the string (full URL) of the Listener.
    29  	Address() string
    30  
    31  	// SetOption sets an option on the Dialer. Setting options
    32  	// can only be done before Dial() has been called.
    33  	SetOption(name string, value interface{}) error
    34  
    35  	// GetOption gets an option value from the Listener.
    36  	GetOption(name string) (interface{}, error)
    37  }