github.com/sagernet/sing-shadowsocks2@v0.2.0/cipher/method.go (about)

     1  package cipher
     2  
     3  import (
     4  	"context"
     5  	"net"
     6  
     7  	M "github.com/sagernet/sing/common/metadata"
     8  	N "github.com/sagernet/sing/common/network"
     9  )
    10  
    11  type Method interface {
    12  	DialConn(conn net.Conn, destination M.Socksaddr) (net.Conn, error)
    13  	DialEarlyConn(conn net.Conn, destination M.Socksaddr) net.Conn
    14  	DialPacketConn(conn net.Conn) N.NetPacketConn
    15  }
    16  
    17  type MethodOptions struct {
    18  	Password string
    19  	Key      []byte
    20  	KeyList  [][]byte
    21  }
    22  
    23  type MethodCreator func(ctx context.Context, methodName string, options MethodOptions) (Method, error)