一:主要测试golang-radius 认证 【radius-ad-windows服务】
lab1:
调用模块———————————————-
code——————————————————-
// radius _T project main.go
package main
import (
“context”
“fmt”
“layeh.com/radius”
. “layeh.com/radius/rfc2865”
)
var (
Username = “xxxx”
Password = “xxxxx”
)
func Radius_client() {
var radpwd = “123456”
packet := radius.New(radius.CodeAccessRequest, [] byte (radpwd))
UserName_SetString(packet, Username)
UserPassword_SetString(packet, Password)
response, err := radius. Exchange (context.Background(), packet, “IP:1812”)
if err != nil {
panic(err)
}
fmt.Print(response.Authenticator)
if response.Code == radius.CodeAccessAccept {
fmt.Println(“Accepted”)
} else {
fmt.Println(“Denied”)
}
}
func main() {
Radius_client()
}
code———————————————————-
二:测试方法-wireshark 抓包 看结果。