Split hkexsh and hkexnet consts into separate files

This commit is contained in:
Russ Magee 2018-09-17 17:27:13 -07:00
parent 869dbf6e10
commit 8b0b833d6e
5 changed files with 50 additions and 38 deletions

11
consts.go Normal file
View File

@ -0,0 +1,11 @@
// Common constants for the HKExSh
//
// Copyright (c) 2017-2018 Russell Magee
// Licensed under the terms of the MIT license (see LICENSE.mit in this
// distribution)
//
// golang implementation by Russ Magee (rmagee_at_gmail.com)
package hkexsh
const Version = "0.5pre (NO WARRANTY)"

37
hkexnet/consts.go Normal file
View File

@ -0,0 +1,37 @@
// consts.go - consts for hkexnet
// Copyright (c) 2017-2018 Russell Magee
// Licensed under the terms of the MIT license (see LICENSE.mit in this
// distribution)
//
// golang implementation by Russ Magee (rmagee_at_gmail.com)
package hkexnet
const (
KEX_HERRADURA = iota // this MUST be first for default if omitted in ctor
KEX_FOO
//KEX_DH
//KEX_ETC
)
// const CSExtendedCode - extended (>255 UNIX exit status) codes
// This indicate channel-related or internal errors
const (
CSENone = 32 + iota
CSEBadAuth // Failed login password
CSETruncCSO // No CSOExitStatus in payload
CSEStillOpen // Channel closed unexpectedly
CSEExecFail // cmd.Start() (exec) failed
CSEPtyExecFail // pty.Start() (exec w/pty) failed
)
const (
CSONone = iota // No error, normal packet
CSOHmacInvalid // HMAC mismatch detected on remote end
CSOTermSize // set term size (rows:cols)
CSOExitStatus // Remote cmd exit status
CSOChaff // Dummy packet, do not pass beyond decryption
)
const MAX_PAYLOAD_LEN = 4*1024*1024*1024 - 1

View File

@ -52,34 +52,6 @@ import (
// algo shall be used (eg., HerraduraKEx, [TODO: others...])
type KEX uint8
const (
KEX_HERRADURA = iota // this MUST be first for default if omitted in ctor
KEX_FOO
//KEX_DH
//KEX_ETC
)
// const CSExtendedCode - extended (>255 UNIX exit status) codes
// This indicate channel-related or internal errors
const (
CSENone = 32 + iota
CSEBadAuth // Failed login password
CSETruncCSO // No CSOExitStatus in payload
CSEStillOpen // Channel closed unexpectedly
CSEExecFail // cmd.Start() (exec) failed
CSEPtyExecFail // pty.Start() (exec w/pty) failed
)
const (
CSONone = iota // No error, normal packet
CSOHmacInvalid // HMAC mismatch detected on remote end
CSOTermSize // set term size (rows:cols)
CSOExitStatus // Remote cmd exit status
CSOChaff // Dummy packet, do not pass beyond decryption
)
const MAX_PAYLOAD_LEN = 4*1024*1024*1024 - 1
/*---------------------------------------------------------------------*/
type (

View File

@ -346,7 +346,7 @@ func rejectUserMsg() string {
// connection (app-specific, passed through to the server to use or
// ignore at its discretion).
func main() {
version := "0.2pre (NO WARRANTY)"
version := hkexsh.Version
var vopt bool
var gopt bool //login via password, asking server to generate authToken
var dbg bool

View File

@ -352,15 +352,7 @@ func GenAuthToken(who string, connhost string) string {
// Listener and Conns. The KEx and encrypt/decrypt is done within the type.
// Compare to 'serverp.go' in this directory to see the equivalence.
func main() {
// This string is purely arbitrary, and is based on the
// author's current impression of how near (and far) this
// code is to being useful in the real world.
// Version 1.0 is an idealistic fever-dream, filled with
// cryptographically-secure rainbows and unicorns flying
// high above the clouds, ignoring various government
// TLAs who shake their fists impotently at the happy
// scene above, where all communicate securely beyond their reach.
version := "0.5pre (NO WARRANTY)"
version := hkexsh.Version
var vopt bool
var chaffEnabled bool