当前位置: 首页>>代码示例>>Golang>>正文


Golang common.LoadConfig函数代码示例

本文整理汇总了Golang中github.com/mdlayher/goat/goat/common.LoadConfig函数的典型用法代码示例。如果您正苦于以下问题:Golang LoadConfig函数的具体用法?Golang LoadConfig怎么用?Golang LoadConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LoadConfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestGetFilesJSON

// TestGetFilesJSON verifies that /api/files returns proper JSON output
func TestGetFilesJSON(t *testing.T) {
	log.Println("TestGetFilesJSON()")

	// Load config
	config := common.LoadConfig()
	common.Static.Config = config

	// Generate mock data.FileRecord
	file := data.FileRecord{
		InfoHash: "deadbeef",
		Verified: true,
	}

	// Save mock file
	if !file.Save() {
		t.Fatalf("Failed to save mock file")
	}

	// Load mock file to fetch ID
	file = file.Load(file.InfoHash, "info_hash")
	if file == (data.FileRecord{}) {
		t.Fatalf("Failed to load mock file")
	}

	// Request output JSON from API for this file
	var file2 data.FileRecord
	err := json.Unmarshal(getFilesJSON(file.ID), &file2)
	if err != nil {
		t.Fatalf("Failed to unmarshal result JSON for single file")
	}

	// Verify objects are the same
	if file.ID != file2.ID {
		t.Fatalf("ID, expected %d, got %d", file.ID, file2.ID)
	}

	// Request output JSON from API for all files
	var allFiles []data.FileRecord
	err = json.Unmarshal(getFilesJSON(-1), &allFiles)
	if err != nil {
		t.Fatalf("Failed to unmarshal result JSON for all files")
	}

	// Verify known file is in result set
	found := false
	for _, f := range allFiles {
		if f.ID == file.ID {
			found = true
		}
	}

	if !found {
		t.Fatalf("Expected file not found in all files result set")
	}

	// Delete mock file
	if !file.Delete() {
		t.Fatalf("Failed to delete mock file")
	}
}
开发者ID:sdgoij,项目名称:goat,代码行数:61,代码来源:files_test.go

示例2: TestWhitelistRecord

// TestWhitelistRecord verifies that WhitelistRecord creation, methods, save, load, and delete work properly
func TestWhitelistRecord(t *testing.T) {
	log.Println("TestWhitelistRecord()")

	// Load config
	config, err := common.LoadConfig()
	if err != nil {
		t.Fatalf("Could not load configuration: %s", err.Error())
	}
	common.Static.Config = config

	// Generate mock WhitelistRecord
	whitelist := WhitelistRecord{
		Client:   "goat_test",
		Approved: true,
	}

	// Save mock whitelist
	if err := whitelist.Save(); err != nil {
		t.Fatalf("Failed to save mock whitelist: %s", err.Error())
	}

	// Load mock whitelist to fetch ID
	whitelist, err = whitelist.Load(whitelist.Client, "client")
	if whitelist == (WhitelistRecord{}) || err != nil {
		t.Fatalf("Failed to load mock whitelist: %s", err.Error())
	}

	// Delete mock whitelist
	if err := whitelist.Delete(); err != nil {
		t.Fatalf("Failed to delete mock whitelist: %s", err.Error())
	}
}
开发者ID:gernest,项目名称:goat,代码行数:33,代码来源:whitelistRecord_test.go

示例3: TestUDPAnnounce

// TestUDPAnnounce verifies that the UDP tracker announce output format is correct
func TestUDPAnnounce(t *testing.T) {
	log.Println("TestUDPAnnounce()")

	// Load config
	config := common.LoadConfig()
	common.Static.Config = config

	// Generate mock data.FileRecord
	file := data.FileRecord{
		InfoHash: "6465616462656566",
		Verified: true,
	}

	// Save mock file
	if !file.Save() {
		t.Fatalf("Failed to save mock file")
	}

	// Generate fake announce query
	query := url.Values{}
	query.Set("info_hash", "deadbeef")
	query.Set("ip", "127.0.0.1")
	query.Set("port", "5000")
	query.Set("uploaded", "0")
	query.Set("downloaded", "0")
	query.Set("left", "0")
	query.Set("numwant", "50")

	// Create a UDP tracker, trigger an announce
	tracker := UDPTracker{TransID: uint32(1234)}
	res := tracker.Announce(query, file)

	// Decode response
	announce := new(udp.AnnounceResponse)
	err := announce.UnmarshalBinary(res)
	if err != nil {
		t.Fatalf("Failed to decode UDP announce response")
	}
	log.Println(announce)

	// Verify correct action
	if announce.Action != 1 {
		t.Fatalf("Incorrect UDP action, expected 1")
	}

	// Encode response, verify same as before
	announceBuf, err := announce.MarshalBinary()
	if err != nil {
		t.Fatalf("Failed to encode UDP announce response")
	}

	if !bytes.Equal(res, announceBuf) {
		t.Fatalf("Byte slices are not identical")
	}

	// Delete mock file
	if !file.Delete() {
		t.Fatalf("Failed to delete mock file")
	}
}
开发者ID:sdgoij,项目名称:goat,代码行数:61,代码来源:udpTracker_test.go

示例4: TestAPIKey

// TestAPIKey verifies that APIKey creation, save, load, and delete work properly
func TestAPIKey(t *testing.T) {
	log.Println("TestAPIKey()")

	// Load config
	config := common.LoadConfig()
	common.Static.Config = config

	// Generate mock APIKey
	key := APIKey{
		UserID: 1,
		Key:    "deadbeef",
		Salt:   "test",
	}

	// Verify key can be saved
	if !key.Save() {
		t.Fatalf("Failed to save keyLog")
	}

	// Verify key can be loaded using matching key
	key2 := key.Load(key.Key, "key")
	if key2 == (APIKey{}) {
		t.Fatal("Failed to load APIKey")
	}

	// Verify key is the same as previous one
	if key.Salt != key2.Salt {
		t.Fatalf("key.Salt, expected %s, got %s", key.Salt, key2.Salt)
	}

	// Verify key can be deleted
	if !key2.Delete() {
		t.Fatalf("Failed to delete APIKey")
	}
}
开发者ID:sdgoij,项目名称:goat,代码行数:36,代码来源:apiKey_test.go

示例5: TestHTTPRouter

// TestHTTPRouter verifies that the main HTTP router is working properly
func TestHTTPRouter(t *testing.T) {
	log.Println("TestHTTPRouter()")

	// Load config
	config, err := common.LoadConfig()
	if err != nil {
		t.Fatalf("Could not load configuration: %s", err.Error())
	}
	common.Static.Config = config

	// Generate mock data.FileRecord
	file := data.FileRecord{
		InfoHash: "6465616462656566303030303030303030303030",
		Verified: true,
	}

	// Save mock file
	if err := file.Save(); err != nil {
		t.Fatalf("Failed to save mock file: %s", err.Error())
	}

	// Generate mock data.FileRecord
	file2 := data.FileRecord{
		InfoHash: "6265656664656164",
		Verified: true,
	}

	// Save mock file
	if err := file2.Save(); err != nil {
		t.Fatalf("Failed to save mock file: %s", err.Error())
	}

	// Iterate all HTTP tests
	for _, test := range httpTests {
		// Generate mock HTTP request
		r, err := http.NewRequest("GET", "http://localhost:8080"+test.url, nil)
		r.Header.Set("User-Agent", "goat_test")
		if err != nil {
			t.Fatalf("Failed to create HTTP request")
		}

		// Capture HTTP writer response with recorder
		w := httptest.NewRecorder()

		// Invoke HTTP router
		parseHTTP(w, r)
		log.Println("TEST:", test.url)
		log.Println(w.Body.String())
	}

	// Delete mock file2
	err = file.Delete()
	err2 := file2.Delete()
	if err != nil || err2 != nil {
		t.Fatalf("Failed to delete mock file : %s %s", err.Error(), err2.Error())
	}
}
开发者ID:gernest,项目名称:goat,代码行数:58,代码来源:httpRouter_test.go

示例6: TestScrapeLog

// TestScrapeLog verifies that scrape log creation, save, load, and delete work properly
func TestScrapeLog(t *testing.T) {
	log.Println("TestScrapeLog()")

	// Load config
	config, err := common.LoadConfig()
	if err != nil {
		t.Fatalf("Could not load configuration: %s", err.Error())
	}
	common.Static.Config = config

	// Generate fake scrape query
	query := url.Values{}
	query.Set("info_hash", "deadbeef000000000000")
	query.Set("ip", "127.0.0.1")

	// Generate struct from query
	scrape := new(ScrapeLog)
	err = scrape.FromValues(query)
	if err != nil {
		t.Fatalf("Failed to create scrape from values: %s", err.Error())
	}

	// Verify proper hex encode of info hash
	if scrape.InfoHash != "6465616462656566303030303030303030303030" {
		t.Fatalf("InfoHash, expected \"6465616462656566303030303030303030303030\", got %s", scrape.InfoHash)
	}

	// Verify same IP
	if scrape.IP != "127.0.0.1" {
		t.Fatalf("IP, expected \"127.0.0.1\", got %s", scrape.IP)
	}

	// Verify scrape can be saved
	if err := scrape.Save(); err != nil {
		t.Fatalf("Failed to save ScrapeLog: %s", err.Error())
	}

	// Verify scrape can be loaded using hex info hash
	scrape2, err := scrape.Load("6465616462656566303030303030303030303030", "info_hash")
	if scrape2 == (ScrapeLog{}) || err != nil {
		t.Fatal("Failed to load ScrapeLog: %s", err.Error())
	}

	// Verify scrape is the same as previous one
	if scrape.InfoHash != scrape2.InfoHash {
		t.Fatalf("scrape.InfoHash, expected %s, got %s", scrape.InfoHash, scrape2.InfoHash)
	}

	// Verify scrape can be deleted
	if err := scrape2.Delete(); err != nil {
		t.Fatalf("Failed to delete ScrapeLog: %s", err.Error())
	}
}
开发者ID:gernest,项目名称:goat,代码行数:54,代码来源:scrapeLog_test.go

示例7: TestPostLogin

// TestPostLogin verifies that /api/login returns proper JSON output
func TestPostLogin(t *testing.T) {
	log.Println("TestPostLogin()")

	// Load config
	config, err := common.LoadConfig()
	if err != nil {
		t.Fatalf("Could not load configuration: %s", err.Error())
	}
	common.Static.Config = config

	// Generate mock data.UserRecord
	mockUser := new(data.UserRecord)
	if err := mockUser.Create("test", "test", 100); err != nil {
		t.Fatalf("Failed to create mock user: %s", err.Error())
	}

	// Save mock user
	if err := mockUser.Save(); err != nil {
		t.Fatalf("Failed to save mock user: %s", err.Error())
	}

	// Load mock user to fetch ID
	user, err := mockUser.Load(mockUser.Username, "username")
	if user == (data.UserRecord{}) || err != nil {
		t.Fatalf("Failed to load mock user: %s", err.Error())
	}

	// Perform login request for this user
	res, err := postLogin(user)
	if err != nil {
		t.Fatalf("Failed to retrieve login JSON: %s", err.Error())
	}
	log.Println(string(res))

	// Unmarshal output JSON
	var key data.JSONAPIKey
	err = json.Unmarshal(res, &key)
	if err != nil {
		t.Fatalf("Failed to unmarshal login JSON: %s", err.Error())
	}

	// Verify same user ID from API
	if user.ID != key.UserID {
		t.Fatalf("Mismatched user IDs, got %d, expected %d", key.UserID, user.ID)
	}

	// Delete mock user
	if err := user.Delete(); err != nil {
		t.Fatalf("Failed to delete mock user: %s", err.Error())
	}
}
开发者ID:gernest,项目名称:goat,代码行数:52,代码来源:login_test.go

示例8: TestFileRecord

// TestFileRecord verifies that FileRecord creation, methods, save, load, and delete work properly
func TestFileRecord(t *testing.T) {
	log.Println("TestFileRecord()")

	// Load config
	config, err := common.LoadConfig()
	if err != nil {
		t.Fatalf("Could not load configuration: %s", err.Error())
	}
	common.Static.Config = config

	// Generate mock FileRecord
	file := FileRecord{
		InfoHash: "deadbeef",
		Verified: true,
	}

	// Save mock file
	if err := file.Save(); err != nil {
		t.Fatalf("Failed to save mock file: %s", err.Error())
	}

	// Load mock file to fetch ID
	file, err = file.Load(file.InfoHash, "info_hash")
	if file == (FileRecord{}) || err != nil {
		t.Fatalf("Failed to load mock file: %s", err.Error())
	}

	// Verify completed is functional
	if _, err := file.Completed(); err != nil {
		t.Fatalf("Failed to fetch file completed")
	}

	// Verify seeders is functional
	if _, err := file.Seeders(); err != nil {
		t.Fatalf("Failed to fetch file seeders")
	}

	// Verify leechers is functional
	if _, err := file.Leechers(); err != nil {
		t.Fatalf("Failed to fetch file leechers")
	}

	// Delete mock file
	if err := file.Delete(); err != nil {
		t.Fatalf("Failed to delete mock file: %s", err.Error())
	}
}
开发者ID:gernest,项目名称:goat,代码行数:48,代码来源:fileRecord_test.go

示例9: TestHTTPAnnounce

// TestHTTPAnnounce verifies that the HTTP tracker announce output format is correct
func TestHTTPAnnounce(t *testing.T) {
	log.Println("TestHTTPAnnounce()")

	// Load config
	config, err := common.LoadConfig()
	if err != nil {
		t.Fatalf("Could not load configuration: %s", err.Error())
	}
	common.Static.Config = config

	// Generate mock data.FileRecord
	file := data.FileRecord{
		InfoHash: "6465616462656566303030303030303030303030",
		Verified: true,
	}

	// Save mock file
	if err := file.Save(); err != nil {
		t.Fatalf("Failed to save mock file: %s", err.Error())
	}

	// Generate fake announce query
	query := url.Values{}
	query.Set("info_hash", "deadbeef")
	query.Set("ip", "127.0.0.1")
	query.Set("port", "5000")
	query.Set("uploaded", "0")
	query.Set("downloaded", "0")
	query.Set("left", "0")

	// Create a HTTP tracker, trigger an announce
	tracker := HTTPTracker{}
	res := tracker.Announce(query, file)
	log.Println(string(res))

	// Unmarshal response
	announce := AnnounceResponse{}
	if err := bencode.Unmarshal(bytes.NewReader(res), &announce); err != nil {
		t.Fatalf("Failed to unmarshal bencode announce response")
	}

	// Delete mock file
	if err := file.Delete(); err != nil {
		t.Fatalf("Failed to delete mock file: %s", err.Error())
	}
}
开发者ID:gernest,项目名称:goat,代码行数:47,代码来源:httpTracker_test.go

示例10: TestScrapeLog

// TestScrapeLog verifies that scrape log creation, save, load, and delete work properly
func TestScrapeLog(t *testing.T) {
	log.Println("TestScrapeLog()")

	// Load config
	config := common.LoadConfig()
	common.Static.Config = config

	// Generate fake scrape query
	query := url.Values{}
	query.Set("info_hash", "deadbeef")
	query.Set("ip", "127.0.0.1")

	// Generate struct from query
	scrape := new(ScrapeLog).FromValues(query)

	// Verify proper hex encode of info hash
	if scrape.InfoHash != "6465616462656566" {
		t.Fatalf("InfoHash, expected \"6465616462656566\", got %s", scrape.InfoHash)
	}

	// Verify same IP
	if scrape.IP != "127.0.0.1" {
		t.Fatalf("IP, expected \"127.0.0.1\", got %s", scrape.IP)
	}

	// Verify scrape can be saved
	if !scrape.Save() {
		t.Fatalf("Failed to save ScrapeLog")
	}

	// Verify scrape can be loaded using hex info hash
	scrape2 := scrape.Load("6465616462656566", "info_hash")
	if scrape2 == (ScrapeLog{}) {
		t.Fatal("Failed to load ScrapeLog")
	}

	// Verify scrape is the same as previous one
	if scrape.InfoHash != scrape2.InfoHash {
		t.Fatalf("scrape.InfoHash, expected %s, got %s", scrape.InfoHash, scrape2.InfoHash)
	}

	// Verify scrape can be deleted
	if !scrape2.Delete() {
		t.Fatalf("Failed to delete ScrapeLog")
	}
}
开发者ID:sdgoij,项目名称:goat,代码行数:47,代码来源:scrapeLog_test.go

示例11: TestFileRecord

// TestFileRecord verifies that FileRecord creation, methods, save, load, and delete work properly
func TestFileRecord(t *testing.T) {
	log.Println("TestFileRecord()")

	// Load config
	config := common.LoadConfig()
	common.Static.Config = config

	// Generate mock FileRecord
	file := FileRecord{
		InfoHash: "deadbeef",
		Verified: true,
	}

	// Save mock file
	if !file.Save() {
		t.Fatalf("Failed to save mock file")
	}

	// Load mock file to fetch ID
	file = file.Load(file.InfoHash, "info_hash")
	if file == (FileRecord{}) {
		t.Fatalf("Failed to load mock file")
	}

	// Verify positive number of completed on file
	if file.Completed() < 0 {
		t.Fatalf("Failed to fetch file completed")
	}

	// Verify positive number of seeders on file
	if file.Seeders() < 0 {
		t.Fatalf("Failed to fetch file seeders")
	}

	// Verify positive number of leechers on file
	if file.Leechers() < 0 {
		t.Fatalf("Failed to fetch file leechers")
	}

	// Delete mock file
	if !file.Delete() {
		t.Fatalf("Failed to delete mock file")
	}
}
开发者ID:sdgoij,项目名称:goat,代码行数:45,代码来源:fileRecord_test.go

示例12: TestUserRecord

// TestUserRecord verifies that user creation, save, load, and delete work properly
func TestUserRecord(t *testing.T) {
	log.Println("TestUserRecord()")

	// Load config
	config, err := common.LoadConfig()
	if err != nil {
		t.Fatalf("Could not load configuration: %s", err.Error())
	}
	common.Static.Config = config

	// Create a user
	user := new(UserRecord)
	if err := user.Create("test", "test", 100); err != nil {
		t.Fatalf("Failed to create UserRecord")
	}

	// Verify proper passkey length
	if len(user.Passkey) != 40 {
		t.Fatalf("user.Passkey is %d characters, expected 40", len(user.Passkey))
	}

	// Verify user can be saved
	if err := user.Save(); err != nil {
		t.Fatalf("Failed to save UserRecord: %s", err.Error())
	}

	// Verify user can be loaded using username
	user2, err := user.Load("test", "username")
	if user2 == (UserRecord{}) || err != nil {
		t.Fatal("Failed to load UserRecord: %s", err.Error())
	}

	// Verify user is the same as previous one
	if user.Passkey != user2.Passkey {
		t.Fatalf("user.Passkey, expected %s, got %s", user.Passkey, user2.Passkey)
	}

	// Verify user can be deleted
	if err := user2.Delete(); err != nil {
		t.Fatalf("Failed to delete UserRecord: %s", err.Error())
	}
}
开发者ID:gernest,项目名称:goat,代码行数:43,代码来源:userRecord_test.go

示例13: TestFileUserRecord

// TestFileUserRecord verifies that FileUserRecord creation, methods, save, load, and delete work properly
func TestFileUserRecord(t *testing.T) {
	log.Println("TestFileUserRecord()")

	// Load config
	config, err := common.LoadConfig()
	if err != nil {
		t.Fatalf("Could not load configuration: %s", err.Error())
	}
	common.Static.Config = config

	// Generate mock FileUserRecord
	fileUser := FileUserRecord{
		FileID:     1,
		UserID:     1,
		IP:         "127.0.0.1",
		Active:     true,
		Completed:  true,
		Announced:  10,
		Uploaded:   5000,
		Downloaded: 5000,
		Left:       0,
		Time:       time.Now().Unix(),
	}

	// Save mock fileUser
	if err := fileUser.Save(); err != nil {
		t.Fatalf("Failed to save mock fileUser: %s", err.Error())
	}

	// Load mock fileUser
	fileUser, err = fileUser.Load(fileUser.FileID, fileUser.UserID, fileUser.IP)
	if fileUser == (FileUserRecord{}) || err != nil {
		t.Fatalf("Failed to load mock fileUser: %s", err.Error())
	}

	// Delete mock fileUser
	if err := fileUser.Delete(); err != nil {
		t.Fatalf("Failed to delete mock fileUser: %s", err.Error())
	}
}
开发者ID:gernest,项目名称:goat,代码行数:41,代码来源:fileUserRecord_test.go

示例14: TestAPIKey

// TestAPIKey verifies that APIKey creation, save, load, and delete work properly
func TestAPIKey(t *testing.T) {
	log.Println("TestAPIKey()")

	// Load config
	config, err := common.LoadConfig()
	if err != nil {
		t.Fatalf("Could not load configuration: %s", err.Error())
	}
	common.Static.Config = config

	// Generate mock APIKey
	key := new(APIKey)
	if err := key.Create(1); err != nil {
		t.Fatalf("Failed to create mock APIKey: %s", err.Error())
	}

	// Verify key can be saved
	if err := key.Save(); err != nil {
		t.Fatalf("Failed to save APIKey: %s", err.Error())
	}

	// Verify key can be loaded using matching pubkey
	key2, err := key.Load(key.Pubkey, "pubkey")
	if err != nil || key2 == (APIKey{}) {
		t.Fatal("Failed to load APIKey: %s", err.Error())
	}

	// Verify key is the same as previous one
	if key.Pubkey != key2.Pubkey {
		t.Fatalf("key.Pubkey, expected %s, got %s", key.Pubkey, key2.Pubkey)
	}

	// Verify key can be deleted
	if err := key2.Delete(); err != nil {
		t.Fatalf("Failed to delete APIKey: %s", err.Error())
	}
}
开发者ID:gernest,项目名称:goat,代码行数:38,代码来源:apiKey_test.go

示例15: TestUDPRouter

// TestUDPRouter verifies that the main UDP router is working properly
func TestUDPRouter(t *testing.T) {
	log.Println("TestUDPRouter()")

	// Load config
	config, err := common.LoadConfig()
	if err != nil {
		t.Fatalf("Could not load configuration: %s", err.Error())
	}
	common.Static.Config = config

	// Generate mock data.FileRecord
	file := data.FileRecord{
		InfoHash: "6465616462656566303030303030303030303030",
		Verified: true,
	}

	// Save mock file
	if err := file.Save(); err != nil {
		t.Fatalf("Failed to save mock file: %s", err.Error())
	}

	// Fake UDP address
	addr, err := net.ResolveUDPAddr("udp", "127.0.0.1:0")
	if err != nil {
		t.Fatalf("Failed to create fake UDP address")
	}

	// Connect packet with handshake
	connect := udp.Packet{udpInitID, 0, 1234}
	connectBuf, err := connect.MarshalBinary()
	if err != nil {
		t.Fatalf("Failed to create UDP connect packet")
	}

	// Perform connection handshake
	res, err := parseUDP(connectBuf, addr)
	if err != nil {
		errRes := new(udp.ErrorResponse)
		err2 := errRes.UnmarshalBinary(res)
		if err2 != nil {
			t.Fatalf(err.Error())
		}

		log.Println("ERROR:", errRes.Error)
		t.Fatalf(err.Error())
	}

	// Retrieve response, get new connection ID, which will be expected by router
	connRes := new(udp.ConnectResponse)
	err = connRes.UnmarshalBinary(res)
	if err != nil {
		t.Fatalf(err.Error())
	}

	// Create announce request
	announce := udp.AnnounceRequest{
		ConnID:     connRes.ConnID,
		Action:     1,
		TransID:    connRes.TransID,
		InfoHash:   []byte("deadbeef000000000000"),
		PeerID:     []byte("00001111222233334444"),
		Downloaded: 0,
		Left:       0,
		Uploaded:   0,
		IP:         0,
		Key:        1234,
		Port:       5000,
	}

	// Get announce bytes
	announceBuf, err := announce.MarshalBinary()
	if err != nil {
		t.Fatalf(err.Error())
	}

	// Send announce to UDP router
	res, err = parseUDP(announceBuf, addr)
	if err != nil {
		errRes := new(udp.ErrorResponse)
		err2 := errRes.UnmarshalBinary(res)
		if err2 != nil {
			t.Fatalf(err.Error())
		}

		log.Println("ERROR:", errRes.Error)
		t.Fatalf(err.Error())
	}

	// Get UDP announce response
	announceRes := new(udp.AnnounceResponse)
	err = announceRes.UnmarshalBinary(res)
	if err != nil {
		errRes := new(udp.ErrorResponse)
		err2 := errRes.UnmarshalBinary(res)
		if err2 != nil {
			t.Fatalf(err.Error())
		}

		log.Println("ERROR:", errRes.Error)
//.........这里部分代码省略.........
开发者ID:gernest,项目名称:goat,代码行数:101,代码来源:udpRouter_test.go


注:本文中的github.com/mdlayher/goat/goat/common.LoadConfig函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。