// NewSession returns a new vici session.
NewSession returns a new vici session.
// NewSession returns a new vici session .
func NewSession(opts ...SessionOption) (*Session, error) {
	var socketPath string
	var network string
	fmt.Println("os type: " + runtime.GOOS)
	if runtime.GOOS == "windows" {
		network = "tcp"
		socketPath = windowsdefaultSocketPath
	} else {
		network = "unix"
		socketPath = defaultSocketPath
	}
	s := &Session{
		sessionOpts: &sessionOpts{
			network: network,
			addr:    socketPath,
			dialer:  (&net.Dialer{}).DialContext,
			conn:    nil,
		},
	}
	for _, opt := range opts {
		opt.apply(s.sessionOpts)
	}
	ctr, err := s.newTransport()
	if err != nil {
		return nil, err
	}
	s.ctr = ctr
	elt, err := s.newTransport()
	if err != nil {
		return nil, err
	}
	s.el = newEventListener(elt)
	return s, nil
}
func NewSession ( opts ... SessionOption ) ( * Session , error ) { var socketPath string var network string fmt . Println ( " " + runtime . GOOS ) if runtime . GOOS == " " { network = " " socketPath = windowsdefaultSocketPath } else { network = " " socketPath = defaultSocketPath } s := & Session { sessionOpts : & sessionOpts { network : network , addr : socketPath , dialer : ( & net . Dialer { } ) . DialContext , conn : nil , } , } for _ , opt := range opts { opt . apply ( s . sessionOpts ) } ctr , err := s . newTransport ( ) if err != nil { return nil , err } s . ctr = ctr elt , err := s . newTransport ( ) if err != nil { return nil , err } s . el = newEventListener ( elt ) return s , nil }
NewSession returns a new vici session.
NewSession returns a new vici session .
// Set default session opts before applying // the opts passed by the caller.