github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/pkg/net/proxy/yuubinsya/plain/auth.go (about)

     1  package plain
     2  
     3  import "github.com/Asutorufa/yuhaiin/pkg/net/proxy/yuubinsya/types"
     4  
     5  type plainAuth struct {
     6  	password    []byte
     7  	passwordLen int
     8  }
     9  
    10  func NewAuth(password []byte) types.Auth {
    11  	return &plainAuth{
    12  		password:    password,
    13  		passwordLen: len(password),
    14  	}
    15  }
    16  
    17  func (a *plainAuth) KeySize() int {
    18  	return a.passwordLen
    19  }
    20  
    21  func (a *plainAuth) Key() []byte {
    22  	return a.password
    23  }
    24  
    25  func (a *plainAuth) Seal(dst, nonce, plaintext, additionalData []byte) []byte { return nil }
    26  func (a *plainAuth) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) {
    27  	return nil, nil
    28  }
    29  
    30  func (a *plainAuth) NonceSize() int { return 0 }
    31  
    32  func (a *plainAuth) Overhead() int { return 0 }