mirror of
https://github.com/jixishi/SerialTerminalForWindowsTerminal.git
synced 2026-06-15 16:42:46 +00:00
2ce672cdde
Move ForwardManager → pkg/forward/Manager and PluginManager → pkg/luaplugin/Manager. Move FoeWardMode (now forward.Mode) with ParseMode/Network/String into pkg/forward. Rename constants: NOT→None, TCPC→TCP, UDPC→UDP. Update all references in main package. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
43 lines
722 B
Go
43 lines
722 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
type Config struct {
|
|
portName string
|
|
baudRate int
|
|
dataBits int
|
|
stopBits int
|
|
parityBit int
|
|
outputCode string
|
|
inputCode string
|
|
endStr string
|
|
enableLog bool
|
|
logFilePath string
|
|
forWard []int
|
|
frameSize int
|
|
timesTamp bool
|
|
timesFmt string
|
|
address []string
|
|
enableGUI bool
|
|
hotkeyMod string
|
|
}
|
|
|
|
var config Config
|
|
|
|
func openLogFile() (*os.File, error) {
|
|
if config.enableLog {
|
|
path := fmt.Sprintf(config.logFilePath, config.portName, time.Now().Format("2006_01_02T150405"))
|
|
f, err := os.OpenFile(path, os.O_RDWR|os.O_APPEND|os.O_CREATE, 0666)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return f, nil
|
|
}
|
|
|
|
return nil, nil
|
|
}
|