github.com/keysonZZZ/kmg@v0.0.0-20151121023212-05317bfd7d39/third/kmgRadius/README.md (about)

     1  a golang radius library
     2  =============================
     3  This project forks from https://github.com/jessta/radius
     4  
     5  ### document
     6  * http://godoc.org/github.com/bronze1man/radius
     7  * http://en.wikipedia.org/wiki/RADIUS
     8  
     9  ### example
    10  ```go
    11  package main
    12  
    13  import (
    14  	"github.com/bronze1man/kmg/third/kmgRadius"
    15  	"github.com/bronze1man/kmg/kmgDebug"
    16  	"github.com/bronze1man/kmg/kmgConsole"
    17  )
    18  
    19  func main() {
    20  	// run the server in a new thread.
    21  	// 在一个新线程里面一直运行服务器.
    22  	kmgRadius.RunServer(":1812", []byte("sEcReT"), kmgRadius.Handler{
    23  		Auth:       func(username string) (password string, exist bool) {
    24  			if username!="a"{
    25  				return "",false
    26  			}
    27  			return "b",true
    28  		},
    29  		AcctStart:  func(req kmgRadius.AcctRequest) {
    30  			kmgDebug.Println("start",req)
    31  		},
    32  		AcctUpdate: func(req kmgRadius.AcctRequest) {
    33  			kmgDebug.Println("update",req)
    34  		},
    35  		AcctStop:   func(req kmgRadius.AcctRequest) {
    36  			kmgDebug.Println("stop",req)
    37  		},
    38  	})
    39  	// wait for the system sign or ctrl-c to close the process.
    40  	// 等待系统信号或者ctrl-c 关闭进程
    41  	kmgConsole.WaitForExit()
    42  }
    43  ```
    44  
    45  ### implemented
    46  * a radius server can handle AccessRequest request from strongswan with ikev1-xauth-psk
    47  * a radius server that can handle AccessRequest request from strongswan with ikev2-eap-psk with ms-chap-v2
    48  * a radius server can handle AccountingRequest request from strongswan with ikev1-xauth-psk
    49  
    50  ### notice
    51  * A radius client has not been implement.
    52  * It works , but it is not stable.
    53  
    54  ### reference
    55  * EAP MS-CHAPv2 packet format 								http://tools.ietf.org/id/draft-kamath-pppext-eap-mschapv2-01.txt
    56  * EAP MS-CHAPv2 											https://tools.ietf.org/html/rfc2759
    57  * RADIUS Access-Request part      							https://tools.ietf.org/html/rfc2865
    58  * RADIUS Accounting-Request part  							https://tools.ietf.org/html/rfc2866
    59  * RADIUS Support For Extensible Authentication Protocol 	https://tools.ietf.org/html/rfc3579
    60  * RADIUS Implementation Issues and Suggested Fixes 			https://tools.ietf.org/html/rfc5080
    61  * Extensible Authentication Protocol (EAP)                  https://tools.ietf.org/html/rfc3748
    62  
    63  ### TODO
    64  * avpEapMessaget.Value error handle.
    65  * implement radius client side.