libportal

package module
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

README

libportal

Library with main models, functions and bindings, using in Portal-related Golang's microservices in Wimark.

Usage

After change any *.toml files you need to regenerate *enums.go files. It can be done with enum-generator tool.

# install enum-generator

go get github.com/wimark/enum-generator
go install github.com/wimark/enum-generator

# build enums
./enums.sh

Wimark Systems, 2021-2022

Documentation

Index

Constants

View Source
const (
	CollPortalUserAccount      = "portal_user_accounts"
	CollPortalUserVoucher      = "portal_user_voucher"
	CollPortalUserHotelVoucher = "portal_user_hotel_voucher"
	CollPortalPaidPlans        = "portal_paid_plans"
	CollPortalPaymentSys       = "portal_payment_system"
	CollPortalTransactions     = "portal_transactions"
)
View Source
const (
	// user clients
	COLL_PORTAL_COLLECTION = "portal_client_sessions"

	// user authentications
	COLL_PORTAL_AUTHENTICATIONS = "portal_client_authentications"

	// webpage of portal settings
	COLL_PAGE_PROFILES = "portal_pages"
	// portal profile settings
	COLL_PORTAL_PROFILES = "portal_profiles"

	// available authentications
	COLL_PORTAL_AUTHEN_CFG = "portal_authentications"
	// available authorizations
	COLL_PORTAL_AUTH_CFG = "portal_authorizations"

	// portal advertisements
	COLL_PORTAL_ADS             = "portal_ads"
	COLL_PORTAL_ADS_STATS       = "portal_ads_stats"
	COLl_PORTAL_ADS_STATS_DAILY = "portal_ads_stats_daily"

	// further accounts
	COLL_PORTAL_USER_ACCOUNTS = "portal_user_accounts"

	// further vouchers
	COLL_PORTAL_VOUCHERS = "portal_vouchers"
)
View Source
const (
	// CollPortalClientLog collection with portal client state moves
	CollPortalClientLog = "portal_client_log"
	// CollPortalClientStat collection with clean portal pass data
	CollPortalClientStat = "portal_client_stat"
	// CollPortalDailyVendor collection with daily aggregated vendors
	CollPortalDailyVendor = "portal_daily_vendor"
	// CollPortalDailyOS collection with daily aggregated OS
	CollPortalDailyOS = "portal_daily_os"
	// CollPortalDailyLocale daily aggregated with locales
	CollPortalDailyLocale = "portal_daily_locale"
	// CollPortalDailyType daily aggregated with useragent type
	CollPortalDailyType = "portal_daily_type"

	CollPortalDailyFirstVisit = "portal_daily_first_visit"
	CollPortalDailyAuth       = "portal_daily_auth"
	CollPortalDailyAuthen     = "portal_daily_authen"
)
View Source
const (
	CollAccessServer = "portal_access_server"
)
View Source
const CollAdStatLog = "portal_ads_stat_log"
View Source
const (
	CollPortalAccounting = "portal_accounting"
)

Variables

This section is empty.

Functions

func AuthenIsAccountable

func AuthenIsAccountable(t PortalAuthenticationType) bool

AuthenIsAccountable return true if authen type could be accountable

func GenerateHotelVoucher

func GenerateHotelVoucher(length int) string

GenerateHotelVoucher function to generate unique alphanumeric voucher code with provided len. Example: GenerateVoucher(6) -> a1b-2c3

func GenerateVoucher

func GenerateVoucher(length int) string

GenerateVoucher function to generate unique alphanumeric voucher code with provided len. Example: GenerateVoucher(6) -> a1b-2c3

Types

type APIRequest

type APIRequest struct {

	// ids for onject query
	Ids []string `json:"ids" query:"ids[]"`

	// for Search
	SearchQuery string `json:"search,omitempty" query:"search"`

	// profiles ids for many objects and access control
	Profiles []string `json:"profiles,omitempty" query:"profiles[]"`

	// account ids for accounts data if needed
	Accounts []string `json:"accounts,omitempty" query:"accounts[]"`

	// tariffs ids for vouchers if needed
	Tariffs []string `json:"tariffs,omitempty" query:"tariffs[]"`

	// locations ids to request
	LocIDs []string `json:"loc_ids,omitempty" query:"loc_ids[]"`

	//AdType  type of ad to download
	AdTypes []string `json:"ad_types" query:"ad_types[]"`

	// account for black/white list
	ActionList    PortalActionListType `json:"action_list" query:"action_list"`
	AccountToList string               `json:"account_to_list" query:"account_to_list"`

	// query for stat (range / pie / timeseries)
	Start   int64  `json:"start" query:"start"`
	Stop    int64  `json:"stop" query:"stop"`
	Object  string `json:"object" query:"object"`
	Subtype string `json:"subtype" query:"subtype"`

	//Query or filter account by DateOfBirth
	Day   int `json:"day" query:"day"`
	Month int `json:"month" query:"month"`
	Year  int `json:"year" query:"year"`

	// for transaction read -- possible values ["day", "week", "month", "quarter"]
	Last string `json:"last,omitempty" query:"last"`

	Query string `json:"q" query:"q"`

	Request []map[string]interface{} `json:"request" query:"request" form:"request"`

	// Pagination
	Sort   string `json:"sort" query:"sort"`
	Offset int    `json:"offset" query:"offset"`
	Limit  int    `json:"limit" query:"limit"`

	// vouchers data
	NumberOfVouchers int `json:"number_of_vouchers" query:"number_of_vouchers"`
	LengthVoucher    int `json:"length_voucher" query:"length_voucher"`

	// if true, get return list code and start stop(about vouchers)
	ListVoucher bool `json:"list_voucher" query:"list_voucher"`
	ClonePage   bool `json:"clone_page" query:"clone_page"`
	MACMask     bool `json:"mac_mask" query:"mac_mask"`
}

APIRequest struct for common HTTP request from other services (like backend)

type APIResponse

type APIResponse struct {
	Code   int         `json:"code"`
	Status string      `json:"status"`
	Total  int         `json:"total,omitempty"`
	Items  interface{} `json:"data,omitempty"`
	Errors []string    `json:"errors,omitempty"`
}

APIResponse struct for common response

type AccessServer

type AccessServer struct {
	ID string `json:"id" bson:"_id"`

	Enable bool             `json:"enable" bson:"enable"`
	Name   string           `json:"name" bson:"name"`
	Type   AccessServerType `json:"type" bson:"type"`

	NasID      string `json:"nas_id" bson:"nas_id"`
	NasIP      string `json:"nas_ip" bson:"nas_ip"`
	ExternalIP string `json:"external_ip" bson:"external_ip"`

	Location    string `json:"location" bson:"location"`
	Description string `json:"description" bson:"description"`

	Login    string `json:"login" bson:"login"`
	Password string `json:"password" bson:"password"`

	PreAuthVSA  string `json:"pre_auth_vsa" bson:"pre_auth_vsa"`
	PostAuthVSA string `json:"post_auth_vsa" bson:"post_auth_vsa"`
	CoaVSA      string `json:"coa_vsa" bson:"coa_vsa"`

	CoaSecret string `json:"coa_secret" bson:"coa_secret"`
	CoaPort   int    `json:"coa_port" bson:"coa_port"`
	MacAuth   bool   `json:"mac_auth" bson:"mac_auth"`
}

AccessServer

type AccessServerType

type AccessServerType string
const AccessServerTypeCiscoISG AccessServerType = "Cisco ISG"
const AccessServerTypeCiscoWLC AccessServerType = "Cisco WLC"
const AccessServerTypeCoovaChilly AccessServerType = "CoovaChilli"
const AccessServerTypeEcoBRAS AccessServerType = "EcoBRAS"
const AccessServerTypeWimark AccessServerType = "Wimark"

func (*AccessServerType) GetBSON

func (en *AccessServerType) GetBSON() (interface{}, error)

func (AccessServerType) GetPtr

func (en AccessServerType) GetPtr() *AccessServerType

func (*AccessServerType) MarshalJSON

func (en *AccessServerType) MarshalJSON() ([]byte, error)

func (*AccessServerType) SetBSON

func (en *AccessServerType) SetBSON(v bson.Raw) error

func (AccessServerType) String

func (en AccessServerType) String() string

func (*AccessServerType) UnmarshalJSON

func (en *AccessServerType) UnmarshalJSON(b []byte) error

type AccountFromSocialNetwork

type AccountFromSocialNetwork struct {
	ID           string   `json:"id" bson:"id"`
	Name         string   `json:"first_name" bson:"first_name"`
	LastName     string   `json:"last_name" bson:"last_name"`
	Email        string   `json:"email" bson:"email"`
	DateOfBirth  string   `json:"birthday" bson:"birthday"`
	Sex          string   `json:"sex" bson:"sex"`
	City         string   `json:"city" bson:"city"`
	Universities []string `json:"universities" bson:"universities"`
	HomeTown     string   `json:"home_town" bson:"home_town"`
	PhotoURL     string   `json:"photo_url" bson:"photo_url"`
}

type AdImageObject

type AdImageObject struct {
	Text  string `json:"text" bson:"text"`
	Image string `json:"image" bson:"image"`
}

type CaptiveRedirect

type CaptiveRedirect struct {
	Name string `json:"name" bson:"name"`

	// URL to redirect (Portal Web part)
	RedirectURL string `json:"redirect_url" bson:"redirect_url"`

	MACWhiteList []string `json:"mac_list" bson:"mac_list"`

	URLWhiteList []DnsAddress `json:"url_list" bson:"url_list"`
	PreAuthList  []string     `json:"preauth_list" bson:"preauth_list"`

	NoMasquerade bool `json:"no_masquerade" bson:"no_masquerade"`
}

CaptiveRedirect struct for manage of Client redirect system

type DailyProfileStat

type DailyProfileStat struct {
	Create   time.Time `json:"create" bson:"create"`
	CreateAt int64     `json:"create_at" bson:"create_at"`
	Time     DayTime   `json:"time" bson:"time"`

	Profile string   `json:"profile" bson:"profile"`
	LocID   string   `json:"loc_id" bson:"loc_id"`
	Values  []string `json:"values" bson:"values"`
	Counts  []int    `json:"counts" bson:"counts"`
}

DailyProfileStat struct represent daily aggregated stats common for os, vendor, devices, etc

type DailyProfileStatDB

type DailyProfileStatDB struct {
	ID     string           `json:"id" bson:"_id"`
	Object DailyProfileStat `json:",inline" bson:",inline"`
}

DailyProfileStatDB struct wrapper with ID for DailyProfileStat

func NewDailyProfileStatDBYesterday

func NewDailyProfileStatDBYesterday(t time.Time, profile, loc string,
	values []string, counts []int) DailyProfileStatDB

NewDailyProfileStat func return new object DailyProfileStat

type DayTime

type DayTime struct {
	Year  int `json:"year" bson:"year"`
	Month int `json:"month" bson:"month"`
	Day   int `json:"day" bson:"day"`
}

DayTime struct fot represent year-month-day object

type DnsAddress

type DnsAddress struct {
	Ip         string `json:"ip" bson:"ip"`
	DomainName string `json:"domain_name" bson:"domain_name"`
}

DnsAddress for link IP with domain name

type GuestControlSettings

type GuestControlSettings struct {
	CaptiveRedirect string   `json:"captive_redirect" bson:"captive_redirect"`
	MACAuth         []string `json:"mac_radius_auth_servers" bson:"mac_radius_auth_servers"`
}

GuestControlSettings for WLAN/Wired Guest Control settings

type Locale added in v1.7.0

type Locale string
const LocaleEn Locale = "en"
const LocaleRu Locale = "ru"
const LocaleTg Locale = "tg"

func (*Locale) GetBSON added in v1.7.0

func (en *Locale) GetBSON() (interface{}, error)

func (Locale) GetPtr added in v1.7.0

func (en Locale) GetPtr() *Locale

func (*Locale) MarshalJSON added in v1.7.0

func (en *Locale) MarshalJSON() ([]byte, error)

func (*Locale) SetBSON added in v1.7.0

func (en *Locale) SetBSON(v bson.Raw) error

func (Locale) String added in v1.7.0

func (en Locale) String() string

func (*Locale) UnmarshalJSON added in v1.7.0

func (en *Locale) UnmarshalJSON(b []byte) error

type MapEntity

type MapEntity struct {
	Key   string `json:"k"`
	Value string `json:"v"`
}

type PollEnabledFields

type PollEnabledFields struct {
	DateOfBirth bool `json:"date_of_birth" bson:"date_of_birth"`
	Sex         bool `json:"sex" bson:"sex"`
}

PollEnabledFields включение опросов о данных пользователя

type PortalActionListType

type PortalActionListType string
const PortalActionListTypeAddToAccessList PortalActionListType = "add_al"
const PortalActionListTypeAddToBlackList PortalActionListType = "add_bl"
const PortalActionListTypeDelFromAccessList PortalActionListType = "del_al"
const PortalActionListTypeDelFromBlackList PortalActionListType = "del_bl"
const PortalActionListTypeGetAccessList PortalActionListType = "get_al"
const PortalActionListTypeGetBlackList PortalActionListType = "get_bl"
const PortalActionListTypeNone PortalActionListType = "none"

func (*PortalActionListType) GetBSON

func (en *PortalActionListType) GetBSON() (interface{}, error)

func (PortalActionListType) GetPtr

func (*PortalActionListType) MarshalJSON

func (en *PortalActionListType) MarshalJSON() ([]byte, error)

func (*PortalActionListType) SetBSON

func (en *PortalActionListType) SetBSON(v bson.Raw) error

func (PortalActionListType) String

func (en PortalActionListType) String() string

func (*PortalActionListType) UnmarshalJSON

func (en *PortalActionListType) UnmarshalJSON(b []byte) error

type PortalAd

type PortalAd struct {
	Id string `json:"id" bson:"_id"`

	// common data
	Name        string `json:"name" bson:"name"`
	Description string `json:"description" bson:"description"`

	// more specific data to link with profiles and authorization
	Profile       string `json:"profile" bson:"profile"`
	Authorization string `json:"authorization" bson:"authorization"`

	// number beetween 1 and 100 - more is higher
	Priority int `json:"priority" bson:"priority"`

	//OS operation system of client
	//OS PortalOSType `json:"os" bson:"os"`
	OS []string `json:"os" bson:"os"`

	//Vendor customer device manufacturers
	Vendor []string `json:"vendor" bson:"vendor"`

	//Platform descktop/mobile
	Platform struct {
		Desktop bool `json:"desktop" bson:"desktop"`
		Mobile  bool `json:"mobile" bson:"mobile"`
		Tablet  bool `json:"tablet" bson:"tablet"`
	} `json:"platform" bson:"platform"`

	// schedule of ads to work start-stop and number of views to show
	Schedule Schedule `json:"schedule" bson:"schedule"`

	NumberOfVisits struct {
		Visits int            `json:"visits" bson:"visits"`
		Sign   PortalSignType `json:"sign" bson:"sign"`
	} `json:"number_of_visits" bson:"number_of_visits"`

	UserRotation struct {
		Sex         string `json:"sex" bson:"sex"`
		DateOfBirth struct {
			Day   int `json:"day" bson:"day"`
			Month int `json:"month" bson:"month"`
			Year  int `json:"year" bson:"year"`
		} `json:"date_of_birth" bson:"date_of_birth"`
		Age  int64  `json:"age" bson:"age"`
		City string `json:"city" bson:"city"`
	} `json:"user_rotation" bson:"user_rotation"`

	LocIDs []string `json:"loc_ids" bson:"loc_ids"`

	Data PortalAdData `json:"data" bson:"data"`
}

PortalAd object for ihot

type PortalAdData

type PortalAdData struct {
	Type PortalAdvertisementType `json:"type" bson:"type"`

	// URL of iframe or URL to file on portal
	URL  string `json:"url" bson:"url"`
	File string `json:"file,omitempty" bson:"-"`

	// Desktop URL
	URLDesktop  string `json:"url_desktop" bson:"url_desktop"`
	FileDesktop string `json:"file_desktop,omitempty" bson:"-"`

	// question and poll variants if type == poll
	Question     string          `json:"question" bson:"question"`
	QuestionDesc string          `json:"question_desc" bson:"question_desc"`
	PollVariants []string        `json:"poll_variants" bson:"poll_variants"`
	PollImage    []AdImageObject `json:"poll_image" bson:"poll_image"`

	Duration     int64 `json:"duration" bson:"duration"`
	SkipDuration int64 `json:"skip_after" bson:"skip_after"`

	// for redirect to client's site
	RedirectURL string `json:"redirect_url" bson:"redirect_url"`

	// title text
	Text string `json:"text" bson:"text"`

	// color options
	Color pageColor `json:"color,omitempty" bson:"color"`

	// color themes
	ThemeType  string `json:"theme_type" bson:"theme_type"`
	ThemeColor string `json:"theme_color" bson:"theme_color"`

	// поля для цвета кнопки и текста кнопки
	RedirectButtonColor string `json:"redirect_button_color" bson:"redirect_button_color"`
	RedirectButtonText  string `json:"redirect_button_text" bson:"redirect_button_text"`

	SelfVariant bool `json:"self_variant" bson:"self_variant"`
	Skip        bool `json:"skip" bson:"skip"`

	// поля означаюзие включен ли опрос данных о пользователя
	PollFields PollEnabledFields `json:"poll_fields" bson:"poll_fields"`
}

type PortalAdStat

type PortalAdStat struct {
	// same ID as portalad
	Id string `json:"id" bson:"_id"`

	Counter        int            `json:"counter" bson:"counter"`
	CounterSkipped int            `json:"counter_skipped" bson:"counter_skipped"`
	Duration       int64          `json:"duration" bson:"duration"`
	PollCounter    map[string]int `json:"poll_counter" bson:"poll_counter"`
	Follows        int            `json:"follows" bson:"follows"`
}

PortalAdStat

type PortalAdStatDaily

type PortalAdStatDaily struct {
	Id   string `json:"id" bson:"_id"`
	IdAd string `json:"id_ad" bson:"id_ad"`

	// more specific data to link with profiles and authorization
	Profile       string `json:"profile" bson:"profile"`
	LocID         string `json:"loc_id"`
	Authorization string `json:"authorization" bson:"authorization"`

	// dat of day
	Year  int `json:"year" bson:"year"`
	Month int `json:"month" bson:"month"`
	Day   int `json:"day" bson:"day"`

	Counter        int            `json:"counter" bson:"counter"`
	CounterSkipped int            `json:"counter_skipped" bson:"counter_skipped"`
	Duration       int64          `json:"duration" bson:"duration"`
	PollCounter    map[string]int `json:"poll_counter" bson:"poll_counter"`
	Follows        int            `json:"follows" bson:"follows"`

	Create   time.Time `json:"create" bson:"create"`
	CreateAt int64     `json:"create_at" bson:"create_at"`
}

type PortalAdStatInc

type PortalAdStatInc struct {
	Counter        int   `json:"counter" bson:"counter"`
	CounterSkipped int   `json:"counter_skipped" bson:"counter_skipped"`
	Duration       int64 `json:"duration" bson:"duration"`
	Follows        int   `json:"follows" bson:"follows"`
}

type PortalAdStatLog

type PortalAdStatLog struct {
	ID      string                  `json:"id" bson:"_id"`
	IDAd    string                  `json:"id_ad" bson:"id_ad"`
	Profile string                  `json:"profile" bson:"profile"`
	LocID   string                  `json:"loc_id" bson:"loc_id"`
	Account string                  `json:"account" bson:"account"`
	TypeAd  PortalAdvertisementType `json:"type_ad" bson:"type_ad"`

	CreateAt int64 `json:"create_at" bson:"create_at"`

	Time struct {
		Day   int `json:"day" bson:"day"`
		Month int `json:"month" bson:"month"`
		Year  int `json:"year" bson:"year"`
	} `json:"time" bson:"time"`

	UA UserAgent `json:"ua" bson:"ua"`

	UserAge         int    `json:"user_age" bson:"user_age"`
	UserDateOfBirth int64  `json:"user_date_of_birth" bson:"user_date_of_birth"`
	UserSex         string `json:"user_sex" bson:"user_sex"`

	CPE         string `json:"cpe" bson:"cpe"`
	MAC         string `json:"mac" bson:"mac"`
	WLAN        string `json:"wlan" bson:"wlan"`
	NASID       string `json:"nas_id" bson:"nas_id"`
	AdFollowURL string `json:"ad_follow_url" bson:"ad_follow_url"`
}

type PortalAdStatRequest

type PortalAdStatRequest struct {
	Id            string `json:"id"`
	Profile       string `json:"profile"`
	LocID         string `json:"loc_id"`
	Authorization string `json:"authorization"`

	Duration          int64                    `json:"duration"`
	Skipped           bool                     `json:"skipped"`
	PollVariant       string                   `json:"poll_variant"`
	PollUserData      PortalPollUserDataAnswer `json:"poll_user_data_answer"`
	FollowRedirectURL bool                     `json:"follow_redirect"`
}

type PortalAdvertisementState

type PortalAdvertisementState string
const PortalAdvertisementStateChecked PortalAdvertisementState = "checked"
const PortalAdvertisementStateNeed PortalAdvertisementState = "none"

func (*PortalAdvertisementState) GetBSON

func (en *PortalAdvertisementState) GetBSON() (interface{}, error)

func (PortalAdvertisementState) GetPtr

func (*PortalAdvertisementState) MarshalJSON

func (en *PortalAdvertisementState) MarshalJSON() ([]byte, error)

func (*PortalAdvertisementState) SetBSON

func (en *PortalAdvertisementState) SetBSON(v bson.Raw) error

func (PortalAdvertisementState) String

func (en PortalAdvertisementState) String() string

func (*PortalAdvertisementState) UnmarshalJSON

func (en *PortalAdvertisementState) UnmarshalJSON(b []byte) error

type PortalAdvertisementType

type PortalAdvertisementType string
const PortalAdvertisementTypeFlash PortalAdvertisementType = "flash"
const PortalAdvertisementTypeIframe PortalAdvertisementType = "iframe"
const PortalAdvertisementTypeImage PortalAdvertisementType = "image"
const PortalAdvertisementTypePoll PortalAdvertisementType = "poll"
const PortalAdvertisementTypePollIm PortalAdvertisementType = "poll_image"
const PortalAdvertisementTypePollQuality PortalAdvertisementType = "poll_quality"
const PortalAdvertisementTypePollUserData PortalAdvertisementType = "poll_user_data"
const PortalAdvertisementTypeVideo PortalAdvertisementType = "video"

func (*PortalAdvertisementType) GetBSON

func (en *PortalAdvertisementType) GetBSON() (interface{}, error)

func (PortalAdvertisementType) GetPtr

func (*PortalAdvertisementType) MarshalJSON

func (en *PortalAdvertisementType) MarshalJSON() ([]byte, error)

func (*PortalAdvertisementType) SetBSON

func (en *PortalAdvertisementType) SetBSON(v bson.Raw) error

func (PortalAdvertisementType) String

func (en PortalAdvertisementType) String() string

func (*PortalAdvertisementType) UnmarshalJSON

func (en *PortalAdvertisementType) UnmarshalJSON(b []byte) error

type PortalAuthObject

type PortalAuthObject struct {
	Timestamp int64 `json:"timestamp" bson:"timestamp"`

	CPE       string `json:"cpe_id" bson:"cpe_id"`
	Ip        string `json:"client_ip" bson:"client_ip"`
	Useragent string `json:"useragent" bson:"useragent"`

	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`
}

PortalAuthObject is struct for store every auth attempt (Deprecated)

type PortalAuthenticationConfig

type PortalAuthenticationConfig struct {
	Id string `json:"id" bson:"_id"`

	Enable bool                     `json:"enable" bson:"enable"`
	Type   PortalAuthenticationType `json:"type" bson:"type"`

	Name        string `json:"name" bson:"name"`
	Description string `json:"description" bson:"description"`

	Remember  int64 `json:"remember" bson:"remember"`
	OPTLength int   `json:"otp_length" bson:"otp_length"`

	PassGateway string `json:"-" bson:"pass_gateway"`

	Validate struct {
		Regex    string `json:"regex" bson:"regex"`
		ErrorMsg string `json:"error" bson:"error"`
	} `json:"validate" bson:"validate"`
}

PortalAuthenticationConfig config of possible authentications

type PortalAuthenticationData

type PortalAuthenticationData struct {
	Type PortalAuthenticationType `json:"type" bson:"type"`

	Identity string `json:"identity" bson:"identity"`
	Password string `json:"password" bson:"password"`

	Remember      int64 `json:"remember" bson:"remember"`
	PushAgreement bool  `json:"push_agree" bson:"push_agree"`

	// additional data if needed (for example full ESIA string)
	Data string `json:"data" bson:"data"`
}

type PortalAuthenticationState

type PortalAuthenticationState string
const PortalAuthenticationStateChecked PortalAuthenticationState = "checked"
const PortalAuthenticationStateNeed PortalAuthenticationState = "need"
const PortalAuthenticationStateSent PortalAuthenticationState = "sent"

func (*PortalAuthenticationState) GetBSON

func (en *PortalAuthenticationState) GetBSON() (interface{}, error)

func (PortalAuthenticationState) GetPtr

func (*PortalAuthenticationState) MarshalJSON

func (en *PortalAuthenticationState) MarshalJSON() ([]byte, error)

func (*PortalAuthenticationState) SetBSON

func (en *PortalAuthenticationState) SetBSON(v bson.Raw) error

func (PortalAuthenticationState) String

func (en PortalAuthenticationState) String() string

func (*PortalAuthenticationState) UnmarshalJSON

func (en *PortalAuthenticationState) UnmarshalJSON(b []byte) error

type PortalAuthenticationType

type PortalAuthenticationType string
const PortalAuthenticationTypeCallFront PortalAuthenticationType = "callfront"
const PortalAuthenticationTypeCallback PortalAuthenticationType = "callback"
const PortalAuthenticationTypeESIA PortalAuthenticationType = "esia"
const PortalAuthenticationTypeEmail PortalAuthenticationType = "email"
const PortalAuthenticationTypeHotelVoucher PortalAuthenticationType = "hotel_voucher"
const PortalAuthenticationTypeNone PortalAuthenticationType = "none"
const PortalAuthenticationTypeSMS PortalAuthenticationType = "sms"
const PortalAuthenticationTypeUserPass PortalAuthenticationType = "userpass"
const PortalAuthenticationTypeVoucher PortalAuthenticationType = "voucher"

func (*PortalAuthenticationType) GetBSON

func (en *PortalAuthenticationType) GetBSON() (interface{}, error)

func (PortalAuthenticationType) GetPtr

func (*PortalAuthenticationType) MarshalJSON

func (en *PortalAuthenticationType) MarshalJSON() ([]byte, error)

func (*PortalAuthenticationType) SetBSON

func (en *PortalAuthenticationType) SetBSON(v bson.Raw) error

func (PortalAuthenticationType) String

func (en PortalAuthenticationType) String() string

func (*PortalAuthenticationType) UnmarshalJSON

func (en *PortalAuthenticationType) UnmarshalJSON(b []byte) error

type PortalAuthorizationConfig

type PortalAuthorizationConfig struct {
	Id string `json:"id" bson:"_id"`

	Enable bool                    `json:"enable" bson:"enable"`
	Type   PortalAuthorizationType `json:"type" bson:"type"`

	Name        string `json:"name" bson:"name"`
	Description string `json:"description" bson:"description"`

	// header and info for showing on captive portal page
	Header string `json:"header" bson:"header"`
	Info   string `json:"info" bson:"info"`

	// advertisements for user
	AdsIDs         []string `json:"ads_ids" bson:"ads_ids"`
	AdsToWatch     int      `json:"ads_to_watch" bson:"ads_to_watch"`
	EnableRotation bool     `json:"enable_rotation" bson:"enable_rotation"`
	EnableAdFollow bool     `json:"enable_ad_follow" bson:"enable_ad_follow"`

	// session configuration
	Config PortalSessionConfig `json:"config" bson:"config"`

	// landing page redirect URL
	RedirectURL string `json:"redirect_url" bson:"redirect_url"`

	// notification config
	Notification PortalNotification `json:"notification" bson:"notification"`

	//SocialNetworkConfig SN auth setting
	SocialNetworkConfig PortalAuthorizationWithSN `json:"social_network_config" bson:"social_network_config"`

	// skip final page (with data about how much to internet)
	SkipFinalPage bool `json:"skip_final_page" bson:"skip_final_page"`

	// is authorisation transferable on NAS
	// thus it could be divided to small chunks on NAS
	Transferable bool `json:"transferable" bson:"transferable"`

	// DEPRECATED
	Ads []PortalAd `json:"ads" bson:"ads"`
}

func (*PortalAuthorizationConfig) SortAd

func (p *PortalAuthorizationConfig) SortAd()

type PortalAuthorizationData

type PortalAuthorizationData struct {
	ConfigId string `json:"config_id" bson:"config_id"`

	Type  PortalAuthorizationType  `json:"type" bson:"type"`
	State PortalAuthorizationState `json:"state" bson:"state"`

	Config PortalSessionConfig `json:"config" bson:"config"`

	// will be deprecated
	Ads []PortalAd `json:"ads" bson:"-"`

	AdsIDs         []string `json:"ads_ids" bson:"ads_ids"`
	AdsToWatch     int      `json:"ads_to_watch" bson:"ads_to_watch"`
	EnableRotation bool     `json:"enable_rotation" bson:"enable_rotation"`
	EnableAdFollow bool     `json:"enable_ad_follow" bson:"enable_ad_follow"`

	RedirectURL string `json:"redirect_url" bson:"redirect_url"`

	Notification PortalNotification `json:"notification" bson:"notification"`

	//SocialNetworkConfig SN auth setting
	SocialNetworkConfig PortalAuthorizationWithSN `json:"social_network_config" bson:"social_network_config"`

	SkipFinalPage bool `json:"skip_final_page" bson:"skip_final_page"`
	Transferable  bool `json:"transferable" bson:"transferable"`
}

type PortalAuthorizationState

type PortalAuthorizationState string
const PortalAuthorizationStateChecked PortalAuthorizationState = "checked"
const PortalAuthorizationStateNeed PortalAuthorizationState = "none"

func (*PortalAuthorizationState) GetBSON

func (en *PortalAuthorizationState) GetBSON() (interface{}, error)

func (PortalAuthorizationState) GetPtr

func (*PortalAuthorizationState) MarshalJSON

func (en *PortalAuthorizationState) MarshalJSON() ([]byte, error)

func (*PortalAuthorizationState) SetBSON

func (en *PortalAuthorizationState) SetBSON(v bson.Raw) error

func (PortalAuthorizationState) String

func (en PortalAuthorizationState) String() string

func (*PortalAuthorizationState) UnmarshalJSON

func (en *PortalAuthorizationState) UnmarshalJSON(b []byte) error

type PortalAuthorizationType

type PortalAuthorizationType string
const PortalAuthorizationTypeExtVoucher PortalAuthorizationType = "ext_voucher"
const PortalAuthorizationTypeFB PortalAuthorizationType = "facebook"
const PortalAuthorizationTypeFree PortalAuthorizationType = "free"
const PortalAuthorizationTypeHotelVoucher PortalAuthorizationType = "hotel_voucher"
const PortalAuthorizationTypeIG PortalAuthorizationType = "instagram"
const PortalAuthorizationTypeNone PortalAuthorizationType = "none"
const PortalAuthorizationTypeSkip PortalAuthorizationType = "skip"
const PortalAuthorizationTypeSponsor PortalAuthorizationType = "sponsor"
const PortalAuthorizationTypeStaff PortalAuthorizationType = "staff"
const PortalAuthorizationTypeSubscription PortalAuthorizationType = "subscription"
const PortalAuthorizationTypeVK PortalAuthorizationType = "vk"
const PortalAuthorizationTypeVoucher PortalAuthorizationType = "voucher"

func (*PortalAuthorizationType) GetBSON

func (en *PortalAuthorizationType) GetBSON() (interface{}, error)

func (PortalAuthorizationType) GetPtr

func (*PortalAuthorizationType) MarshalJSON

func (en *PortalAuthorizationType) MarshalJSON() ([]byte, error)

func (*PortalAuthorizationType) SetBSON

func (en *PortalAuthorizationType) SetBSON(v bson.Raw) error

func (PortalAuthorizationType) String

func (en PortalAuthorizationType) String() string

func (*PortalAuthorizationType) UnmarshalJSON

func (en *PortalAuthorizationType) UnmarshalJSON(b []byte) error

type PortalAuthorizationWithSN

type PortalAuthorizationWithSN struct {
	RedirectURL string `json:"redirect_url" bson:"redirect_url"`
	GroupURL    string `json:"group_url" bson:"group_url"`
	Post        struct {
		Message     string `json:"message" bson:"message"`
		AttachedURL string `json:"attached_url" bson:"attached_url"`
	} `json:"post" bson:"post"`
}

PortalAuthorizationWithSN авторизация с помощью социальных сетей

type PortalBackendRequest

type PortalBackendRequest struct {
	// Needed client data
	MAC   string `json:"mac"`
	CPE   string `json:"cpe_id"`
	WLAN  string `json:"wlan_id"`
	Ip    string `json:"client_ip"`
	NAS   string `json:"nas"`
	LocID string `json:"loc_id"`
	Hash  string `json:"hash"`

	// client credentials
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`

	// browser specific data
	UserAgent string `json:"useragent"`

	// Address of platform CoA manager
	SwitchURL string `json:"switch_url"`

	// Remember period for user accounts
	Remember int64 `json:"remember"`

	// Type of choosen type
	Type string `json:"type"`

	// info for watched advertisement / poll
	Ad PortalAdStatRequest `json:"ad"`

	// auth type -- free / sponsor / paid / etc
	AuthType string `json:"auth_type"`

	// authentype -- sms / callback / etc
	AuthenType string `json:"authen_type"`

	// voucher for paid voucher internet
	Voucher string `json:"voucher"`

	// account update data
	AccountName    string `json:"account_name"`
	AccountSurName string `json:"account_surname"`

	// tarriff to buy a voucher
	Tariff string `json:"tariff"`

	// payment system
	PaymentSystem string `json:"payment_system"`
	PaymentAmount int    `json:"payment_amount"`

	// vouchers
	Vouchers []string `json:"vouchers"`

	// client locale
	Locale string `json:"locale"`

	//socialNetwork data
	SocialNetwork map[string]AccountFromSocialNetwork `json:"social_network"`

	// segment for knowing where from this user is
	Segment string `json:"segment"`

	// for internal using
	Timeout int64 `json:"-" validate:"-"`
	// profile id
	Profile string `json:"-" validate:"-"`

	// push aggrement
	PushAgreement bool `json:"push_agree"`

	// for voucher activation in once
	Activate bool `json:"activate"`

	// is CNA (Captive network Assistant)
	CNA bool `json:"cna"`

	// is session transferable (internal usage)
	Transferable bool `json:"transferable"`

	// Add For UAM (aka Coova Chilli) server
	Res       string `json:"res"`
	UAMIP     string `json:"uamip"`
	UAMPort   string `json:"uamport"`
	Challenge string `json:"challenge"`
	Called    string `json:"called"`
	// MAC       string
	IP        string `json:"ip"`
	NasID     string `json:"nasid"`
	SessionID string `json:"sessionid"`
	UserURL   string `json:"userurl"`
}

PortalBackendRequest struct for request from frontend to backend

type PortalBackendResponse

type PortalBackendResponse struct {
	// status - success / error
	Status PortalResponseStatus `json:"status,omitempty"`
	// code 0 if OK, > 1 another
	Code int `json:"code"`
	// desctiption if error
	Description string `json:"description,omitempty"`
	// current state - authen, auth, ad, pass
	State PortalUserState `json:"state,omitempty"`
	// current substate - need, check
	Substate string `json:"substate,omitempty"`
	// additional data if needed
	Data interface{} `json:"data,omitempty"`

	// additional available data
	Available interface{} `json:"available,omitempty"`
	// account data provided
	Account interface{} `json:"account,omitempty"`

	// data for new auth stage
	Data2 interface{} `json:"data2,omitempty"`

	// "removal" of identification and authorization of clients
	IsDeleted bool `json:"is_deleted"`
}

PortalResponseObject struct for answer from Portal backend to frontend

type PortalClientAuthentication

type PortalClientAuthentication struct {
	Id string `json:"id" bson:"_id"`

	// client identification
	MAC     string `json:"mac" bson:"mac"`
	Profile string `json:"profile" bson:"profile"`

	WLAN string `json:"wlan_id" bson:"wlan_id"` // not actually needed

	// data with identity and authentication info
	Data PortalAuthenticationData `json:"data" bson:"data"`

	Create time.Time `json:"create" bson:"create"`

	// valid time
	CreateAt int64 `json:"create_at" bson:"create_at"`
	ExpireAt int64 `json:"expire_at" bson:"expire_at"`

	// "removal" of identification and authorization of clients
	IsDeleted bool `json:"is_deleted" bson:"is_deleted"`
}

PortalClientAuthentication struct for store portal client authen client could be authenticated in one profile

type PortalClientLog

type PortalClientLog struct {
	Profile   string    `json:"profile" bson:"profile"`
	LocID     string    `json:"loc_id" bson:"loc_id"`
	MAC       string    `json:"mac" bson:"mac"`
	Identity  string    `json:"identity,omitempty" bson:"identity,omitempty"`
	Account   string    `json:"account,omitempty" bson:"account"`
	UserAgent string    `json:"useragent" bson:"useragent"`
	Locale    string    `json:"locale" bson:"locale"`
	Path      string    `json:"path" bson:"path"`
	State     string    `json:"state" bson:"state"`
	Success   bool      `json:"success" bson:"success"`
	Error     string    `json:"error,omitempty" bson:"error,omitempty"`
	Create    time.Time `json:"create" bson:"create"`
	CreateAt  int64     `json:"create_at" bson:"create_at"`
}

PortalClientLog for logging every user state (index should be for 1 month)

type PortalClientSession

type PortalClientSession struct {
	ID string `json:"id" bson:"_id"`

	// identity
	MAC     string `json:"mac" bson:"mac"`
	WLAN    string `json:"wlan_id" bson:"wlan_id"`
	CPE     string `json:"cpe" bson:"cpe"`
	NAS     string `json:"nas" bson:"nas"`
	LocID   string `json:"loc_id" bson:"loc_id"`
	IP      string `json:"ip" bson:"ip"`
	Hash    string `json:"hash" bson:"hash"`
	Segment string `json:"segment" bson:"segment"`

	// link with profile and account
	Profile string `json:"profile" bson:"profile"`
	Account string `json:"account" bson:"account"`

	// creation time (index needs)
	Create time.Time `json:"create" bson:"create"`

	// from create to end of internet + block
	CreateAt int64 `json:"create_at" bson:"create_at"`
	ExpireAt int64 `json:"expire_at" bson:"expire_at"`

	// real internet part
	StartAt  int64 `json:"start_at" bson:"start_at"`
	StopAt   int64 `json:"stop_at" bson:"stop_at"`
	Duration int64 `json:"duration" bson:"duration"`

	SessionConfig PortalSessionConfig `json:"session_config" bson:"session_config"`
	Auth          []PortalAuthObject  `json:"auth" bson:"auth"`

	State       PortalUserState `json:"state" bson:"state"`
	AuthenState PortalAuthenticationState
	AuthState   PortalAuthorizationState

	Authentication PortalAuthenticationData `json:"authentication" bson:"authentication"`
	Authorization  PortalAuthorizationData  `json:"authorization" bson:"authorization"`

	// data from UserAgent
	UA     UserAgent `json:"ua" bson:"ua"`
	Locale string    `json:"locale" bson:"locale"`

	// will be deprecated
	Status   string `json:"status" bson:"status"`
	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`

	// "removal" of identification and authorization of clients
	IsDeleted bool `json:"is_deleted" bson:"is_deleted"`

	// Cost sms from sms.ru
	Cost float64 `json:"cost" bson:"cost"`

	SocialNetwork map[string]AccountFromSocialNetwork `json:"social_network" bson:"social_network"`

	AcctSessionID string `json:"acct_session_id" bson:"acct_session_id"`
}

PortalClientSession is struct for store portal client

type PortalClientStat

type PortalClientStat struct {
	Profile  string `json:"profile" bson:"profile"`
	LocID    string `json:"loc_id" bson:"loc_id"`
	MAC      string `json:"mac" bson:"mac"`
	Identity string `json:"identity,omitempty" bson:"identity,omitempty"`
	Account  string `json:"account,omitempty" bson:"account"`

	AuthenType string `json:"authen" bson:"authen,omitempty"`
	AuthType   string `json:"auth" bson:"auth,omitempty"`

	UA         UserAgent `json:"ua" bson:"ua"`
	Vendor     string    `json:"vendor" bson:"vendor"`
	Locale     string    `json:"locale" bson:"locale"`
	FirstVisit string    `json:"first_visit" bson:"first_visit"`

	Create   time.Time `json:"create" bson:"create"`
	CreateAt int64     `json:"create_at" bson:"create_at"`
}

PortalClientStat for stats portal passed users

type PortalCondition

type PortalCondition struct {
	WLAN  []string `json:"wlan" bson:"wlan"`
	CPE   []string `json:"cpe" bson:"cpe"`
	NasID []string `json:"nas_id" bson:"nas_id"`
	LocID []string `json:"loc_id" bson:"loc_id"`
}

PortalCondition struct for apply profile condition

func (*PortalCondition) Empty

func (pc *PortalCondition) Empty() bool

Empty func to check struct for empty

type PortalConditionRequest

type PortalConditionRequest struct {
	WLAN  string `json:"wlan,omitempty" bson:"wlan"`
	CPE   string `json:"cpe,omitempty" bson:"cpe"`
	NasID string `json:"nas_id,omitempty" bson:"nas_id"`
	LocID string `json:"loc_id,omitempty" bson:"loc_id"`
}

PortalConditionRequest request for condition of profile

type PortalDailyLocale

type PortalDailyLocale = DailyProfileStat

type PortalDailyOS

type PortalDailyOS = DailyProfileStat

type PortalDailyType

type PortalDailyType = DailyProfileStat

type PortalDailyVendor

type PortalDailyVendor = DailyProfileStat

type PortalMSISDNConfig

type PortalMSISDNConfig struct {
	// example: {"992": ["90","92"...]}
	Prefix map[string][]string `json:"prefix" bson:"prefix"`
	PrMap  []string            `json:"-" bson:"map"`
}

PortalMSISDNConfig config of possible CC and NDC prefixes in MSISDN

func (PortalMSISDNConfig) Check

func (p PortalMSISDNConfig) Check(phone string) bool

func (*PortalMSISDNConfig) Map

func (p *PortalMSISDNConfig) Map()

Map (PortalMSISDNConfig) func to Map DEF / CC codes

type PortalNotification

type PortalNotification struct {
	Enable            bool   `json:"enable" bson:"enable"`
	Text              string `json:"text" bson:"text"`
	SecondsBeforeStop int    `json:"seconds_before_stop" bson:"seconds_before_stop"`
}

PortalNotification struct for send notification with text before session stop

type PortalOSType

type PortalOSType string
const PortalOSTypeAndroid PortalOSType = "Android"
const PortalOSTypeIOS PortalOSType = "iPhone OS"
const PortalOSTypeLinux PortalOSType = "Linux"
const PortalOSTypeMacOs PortalOSType = "Mac Os"
const PortalOSTypeNone PortalOSType = "none"
const PortalOSTypeWindows PortalOSType = "Windows"

func (*PortalOSType) GetBSON

func (en *PortalOSType) GetBSON() (interface{}, error)

func (PortalOSType) GetPtr

func (en PortalOSType) GetPtr() *PortalOSType

func (*PortalOSType) MarshalJSON

func (en *PortalOSType) MarshalJSON() ([]byte, error)

func (*PortalOSType) SetBSON

func (en *PortalOSType) SetBSON(v bson.Raw) error

func (PortalOSType) String

func (en PortalOSType) String() string

func (*PortalOSType) UnmarshalJSON

func (en *PortalOSType) UnmarshalJSON(b []byte) error

type PortalPageProfile

type PortalPageProfile struct {
	Id string `json:"id" bson:"_id"`

	Name        string `json:"name" bson:"name"`
	Description string `json:"description" bson:"description"`

	// URL generated id
	IdURL string `json:"url_id" bson:"url_id"`

	// title of webpage
	Title string `json:"title" bson:"title"`

	// footer text
	Footer string `json:"footer" bson:"footer"`

	// interface features
	Interface struct {
		// Favicon    string `json:"favicon" bson:"-"`
		Logo       string `json:"logo" bson:"-"`
		LogoFooter string `json:"logo_footer" bson:"-"`
		Background string `json:"background" bson:"-"`

		// FaviconURL    string `json:"favicon_url" bson:"favicon_url"`
		LogoURL       string `json:"logo_url" bson:"logo_url"`
		LogoFooterURL string `json:"logo_footer_url" bson:"logo_footer_url"`
		BackgroundURL string `json:"background_url" bson:"background_url"`
		ButtonColor   string `json:"button_color" bson:"button_color"`

		Color pageColor `json:"color" bson:"color"`

		// color themes (new 1.3)
		Theme      string `json:"theme" bson:"theme"`
		ThemeType  string `json:"theme_type" bson:"theme_type"`
		ThemeColor string `json:"theme_color" bson:"theme_color"`
	} `json:"interface" bson:"interface"`

	// locales
	Locales map[Locale]string `json:"locales" bson:"locales"`

	// service aggrement per locale
	Agreements map[Locale]string `json:"agreements" bson:"agreements"`

	// service aggrement plain text (no locale)
	Agreement string `json:"agreement" bson:"agreement"`

	// support field (email / phone / etc) (no locale)
	Support string `json:"support" bson:"support"`
}

PortalPageProfile provide page information

type PortalPageSchedule

type PortalPageSchedule struct {
	ID       string   `json:"id" bson:"_id"`
	PageID   string   `json:"page_id" bson:"page_id"`
	PageURL  string   `json:"page_url" bson:"page_url"`
	LocID    string   `json:"loc_id" bson:"loc_id"`
	Schedule Schedule `json:"schedule" bson:"schedule"`
}

PortalPageSchedule for schedule of page_id to be on loc_id URL

type PortalPaymentSystem

type PortalPaymentSystem struct {
	ID string `json:"id" bson:"_id"`

	Name string                  `json:"name" bson:"name"`
	Type PortalPaymentSystemType `json:"type" bson:"type"`

	// for External
	Merchant   string `json:"merchant" bson:"merchant"`
	Profile    string `json:"profile" bson:"profile"`
	TranUnique bool   `json:"tran_unique" bson:"tran_unique"`

	// for buttons / guides
	Image string `json:"image" bson:"image"`
	Text  string `json:"text" bson:"text"`
	Head  string `json:"head" bson:"head"`

	// only for ExternalURL
	TemplateURL  string `json:"template_url" bson:"template_url"`
	TemplateHash string `json:"template_hash" bson:"template_hash"`
	HashKey      string `json:"hash_key" bson:"hash_key"`

	// will be deprecated
	Identity string `json:"identity" bson:"identity"`
}

PortalPaymentSystem struct for represent PS (Humo, Megafon Life, Robokassa, etc)

type PortalPaymentSystemType

type PortalPaymentSystemType string
const PortalPaymentSystemTypeExternal PortalPaymentSystemType = "ext"
const PortalPaymentSystemTypeExternalURL PortalPaymentSystemType = "ext_url"
const PortalPaymentSystemTypeGuide PortalPaymentSystemType = "guide"

func (*PortalPaymentSystemType) GetBSON

func (en *PortalPaymentSystemType) GetBSON() (interface{}, error)

func (PortalPaymentSystemType) GetPtr

func (*PortalPaymentSystemType) MarshalJSON

func (en *PortalPaymentSystemType) MarshalJSON() ([]byte, error)

func (*PortalPaymentSystemType) SetBSON

func (en *PortalPaymentSystemType) SetBSON(v bson.Raw) error

func (PortalPaymentSystemType) String

func (en PortalPaymentSystemType) String() string

func (*PortalPaymentSystemType) UnmarshalJSON

func (en *PortalPaymentSystemType) UnmarshalJSON(b []byte) error

type PortalPollUserDataAnswer

type PortalPollUserDataAnswer struct {
	Sex         string `json:"sex" bson:"sex"`
	DateOfBirth struct {
		Day   int `json:"day" bson:"day"`
		Month int `json:"month" bson:"month"`
		Year  int `json:"year" bson:"year"`
	} `json:"date_of_birth" bson:"date_of_birth"`
}

PortalPollUserDataAnswer for answer about user data(sex,date_of_birth etc)

type PortalProfile

type PortalProfile struct {
	Id string `json:"id" bson:"_id"`

	ShortID     string `json:"short_id" bson:"short_id"`
	Name        string `json:"name" bson:"name"`
	Description string `json:"description" bson:"description"`

	// condition to check
	// TODO: check profile special API to find what profile will be for condition
	Condition PortalCondition `json:"condition" bson:"condition"`

	// authentication types
	Authentications    []PortalAuthenticationConfig `json:"authentications" bson:"authentications"`
	AuthenticationSkip bool                         `json:"authn_skip" bson:"authn_skip"`

	// available MSISDN prefixes --
	MSISDNConfig PortalMSISDNConfig `json:"msisdn_config" bson:"msisdn_config"`

	// authorization types
	Authorizations       []PortalAuthorizationConfig `json:"authorizations" bson:"authorizations"`
	AuthorizationDefault string                      `json:"authz_default" bson:"authz_default"`

	// limits for authens and auths per page
	AuthenticationLimit int `json:"authentication_limit" bson:"authentication_limit"`
	AuthorizationLimit  int `json:"authorization_limit" bson:"authorization_limit"`

	//AccessList list to pass special user by code
	AccessList map[string]bool `json:"access_list" bson:"access_list"`
	//WhiteList to pass user with out auth
	WhiteList map[string]bool `json:"white_list" bson:"white_list"`
	//BlackList is list to block user
	BlackList map[string]bool `json:"black_list" bson:"black_list"`

	// default session configuration (timeout and block timeout)
	SessionConfig PortalSessionConfig `json:"session_config" bson:"session_config"`

	// UTC diff (plus or minus from UTC time)
	UTCDiff int `json:"utc_diff" bson:"utc_diff"`

	MACsLimit int `json:"macs_limit" bson:"macs_limit"`

	// to payments and payments system integration
	AllowBalance   bool     `json:"allow_balance" bson:"allow_balance"`
	PaymentSystems []string `json:"payment_systems" bson:"payment_systems"`

	// settings for terms of service (no locale)
	TermsOfService struct {
		Enable   bool   `json:"enable" bson:"enable"`
		External bool   `json:"external" bson:"external"`
		FileURL  string `json:"file_url" bson:"file_url"`
		Text     string `json:"text" bson:"text"`
	} `json:"terms_of_service" bson:"terms_of_service"`

	// messages for OTP codes / vouchers and subscriptions
	PushText struct {
		OTP          string `json:"otp" bson:"otp"`
		Voucher      string `json:"voucher" bson:"voucher"`
		Subscription string `json:"subscription" bson:"subscription"`
	} `json:"push_text" bson:"push_text"`

	// Block page for Random (Local Assigned) MAC Addresses
	RandomMACBlockPage bool `json:"random_mac_block_page" bson:"random_mac_block_page"`

	// settings for PushAgreement (no locale)
	PushAgreement struct {
		Enable   bool   `json:"enable" bson:"enable"`
		External bool   `json:"external" bson:"external"`
		FileURL  string `json:"file_url" bson:"file_url"`
		Text     string `json:"text" bson:"text"`
	} `json:"push_agreement" bson:"push_agreement"`

	// service private area
	EnableLineCabinet bool `json:"enable_line_cabinet" bson:"enable_line_cabinet"`
}

PortalProfile to link portal and it's config

func (*PortalProfile) SortAd

func (p *PortalProfile) SortAd()

type PortalReportObjectType

type PortalReportObjectType string
const PortalReportObjectTypeAdAndPollsReport PortalReportObjectType = "ad_and_polls"
const PortalReportObjectTypeClientsReport PortalReportObjectType = "clients"
const PortalReportObjectTypeDateOfBirthReport PortalReportObjectType = "date_of_birth"
const PortalReportObjectTypeNone PortalReportObjectType = "none"
const PortalReportObjectTypeSessionReport PortalReportObjectType = "session"
const PortalReportObjectTypeStatReport PortalReportObjectType = "stat"

func (*PortalReportObjectType) GetBSON

func (en *PortalReportObjectType) GetBSON() (interface{}, error)

func (PortalReportObjectType) GetPtr

func (*PortalReportObjectType) MarshalJSON

func (en *PortalReportObjectType) MarshalJSON() ([]byte, error)

func (*PortalReportObjectType) SetBSON

func (en *PortalReportObjectType) SetBSON(v bson.Raw) error

func (PortalReportObjectType) String

func (en PortalReportObjectType) String() string

func (*PortalReportObjectType) UnmarshalJSON

func (en *PortalReportObjectType) UnmarshalJSON(b []byte) error

type PortalResponseStatus

type PortalResponseStatus string
const PortalResponseStatusError PortalResponseStatus = "error"
const PortalResponseStatusSuccess PortalResponseStatus = "success"

func (*PortalResponseStatus) GetBSON

func (en *PortalResponseStatus) GetBSON() (interface{}, error)

func (PortalResponseStatus) GetPtr

func (*PortalResponseStatus) MarshalJSON

func (en *PortalResponseStatus) MarshalJSON() ([]byte, error)

func (*PortalResponseStatus) SetBSON

func (en *PortalResponseStatus) SetBSON(v bson.Raw) error

func (PortalResponseStatus) String

func (en PortalResponseStatus) String() string

func (*PortalResponseStatus) UnmarshalJSON

func (en *PortalResponseStatus) UnmarshalJSON(b []byte) error

type PortalSessionConfig

type PortalSessionConfig struct {

	// session timeout -- 30 min as example
	Timeout int64 `json:"timeout" bson:"timeout"`

	// timeout to remember
	AuthTimeout int64 `json:"auth_timeout" bson:"auth_timeout"`

	// block after using timeout for (example: 3600 is for seconds online)
	BlockAfterTimeout int64 `json:"block_after" bson:"block_after"`

	// expiration of block after (example: 7200 is for seconds to nullify block_after)
	BlockExpireTimeout int64 `json:"block_expire" bson:"block_expire"`

	// traffic limit
	DownloadLimit int `json:"download_limit" bson:"download_limit"`

	// max number
	MaxSessions int `json:"max_sessions" bson:"max_sessions"`

	// DEPRECATED field for block timeout
	BlockTimeout int64 `json:"block_timeout" bson:"block_timeout"`
}

PortalSessionConfig struct for flexible session config

type PortalSignType

type PortalSignType string
const PortalSignTypeEqual PortalSignType = "equal"
const PortalSignTypeGreater PortalSignType = "greater"
const PortalSignTypeLess PortalSignType = "less"

func (*PortalSignType) GetBSON

func (en *PortalSignType) GetBSON() (interface{}, error)

func (PortalSignType) GetPtr

func (en PortalSignType) GetPtr() *PortalSignType

func (*PortalSignType) MarshalJSON

func (en *PortalSignType) MarshalJSON() ([]byte, error)

func (*PortalSignType) SetBSON

func (en *PortalSignType) SetBSON(v bson.Raw) error

func (PortalSignType) String

func (en PortalSignType) String() string

func (*PortalSignType) UnmarshalJSON

func (en *PortalSignType) UnmarshalJSON(b []byte) error

type PortalTariffPlan

type PortalTariffPlan struct {
	ID string `json:"id" bson:"_id"`

	Profile string `json:"profile" bson:"profile"`

	// tariff plan code be for vouchers or for subscriptions
	Type TariffPlanType `json:"type" bson:"type"`

	// name of plan
	Name string `json:"name" bson:"name"`

	// limits
	SpeedLimit   int   `json:"speed" bson:"speed"`
	TimeoutLimit int64 `json:"session" bson:"session"`
	TrafficLimit int   `json:"traffic" bson:"traffic"`

	// how much to pay
	Amount   int    `json:"amount" bson:"amount"`
	Currency string `json:"currency" bson:"currency"`

	// data for subscriptions
	Reccuring         bool   `json:"recurring" bson:"recurring"`
	ReccuringInterval string `json:"recurring_period" bson:"recurring_period"`

	// friendly description on different languages
	Description map[Locale]string `json:"description" bson:"description"`

	// service info
	Create   time.Time `json:"create" bson:"create"`
	CreateAt int64     `json:"create_at" bson:"create_at"`
}

PortalTariffPlan struct to represent paid plans (tariffs)

type PortalTransaction

type PortalTransaction struct {
	ID string `json:"id" bson:"_id"`

	Profile string `json:"profile" bson:"profile"`

	Account  string `json:"account" bson:"account"`
	Identity string `json:"identity" bson:"identity"`

	Value    int    `json:"balance" bson:"balance"`
	Currency string `json:"currency" bson:"currency"`

	Type string `json:"type" bson:"type"`
	Fill bool   `json:"fill" bson:"fill"`

	Create   time.Time `json:"create" bson:"create"`
	CreateAt int64     `json:"create_at" bson:"create_at"`
}

PortalTransaction struct for represent balance transactions

type PortalUserAccount

type PortalUserAccount struct {
	ID string `json:"id" bson:"_id"`

	// identity info
	Profile            string   `json:"profile" bson:"profile"`
	Identity           string   `json:"identity" bson:"identity"`
	AuthenticationCode string   `json:"authentication_code" bson:"authentication_code"`
	MACs               []string `json:"macs" bson:"macs"`

	// basic personal info
	Name    string `json:"name" bson:"name"`
	SurName string `json:"surname" bson:"surname"`

	DateOfBirth       string `json:"date_of_birth" bson:"date_of_birth"`
	DateOfBirthStruct struct {
		Day   int `json:"day" bson:"day"`
		Month int `json:"month" bson:"month"`
		Year  int `json:"year" bson:"year"`
	} `json:"date_of_birth_struct" bson:"date_of_birth_struct"`

	// personal info
	Email    string `json:"email" bson:"email"`
	Phone    string `json:"phone" bson:"phone"`
	Sex      string `json:"sex" bson:"sex"`
	City     string `json:"city" bson:"city"`
	HomeTown string `json:"home_town" bson:"home_town"`
	PhotoURL string `json:"photo_url" bson:"photo_url"`

	// data for external addintional use
	Passport       string      `json:"passport" bson:"passport"`
	AdditionalData interface{} `json:"additional_data" bson:"addition_data"`

	// info from social network after authorizations
	SocialNetwork map[string]AccountFromSocialNetwork `json:"social_network" bson:"social_network"`

	// is filled filled bt user and acceptable for pushes from portal
	Filled        bool `json:"filled" bson:"filled"`
	PushAgreement bool `json:"push_agreement" bson:"push_agreement"`

	// balance for paid internet
	Balance  int    `json:"balance" bson:"balance"`
	Currency string `json:"currency" bson:"currency"`

	// creation time
	Create   time.Time `json:"create" bson:"create"`
	CreateAt int64     `json:"create_at" bson:"create_at"`

	// common statistics
	Visits map[string]int `json:"visits" bson:"visits"`

	// subscription data
	SubscribeID       string `json:"subscribe_id" bson:"subscribe_id"`
	CreateAtSubscribe int64  `json:"create_at_subscribe" bson:"create_at_subscribe"`
}

PortalUserAccount struct to represent user account for Profile

type PortalUserAccountShort

type PortalUserAccountShort struct {
	Profile string `json:"profile" bson:"profile"`

	Identity string   `json:"identity" bson:"identity"`
	MACs     []string `json:"macs" bson:"macs"`

	Name    string `json:"name" bson:"name"`
	SurName string `json:"surname" bson:"surname"`
	Filled  bool   `json:"filled" bson:"filled"`

	PushAgreement bool `json:"push_agreement" bson:"push_agreement"`

	Balance  int    `json:"balance" bson:"balance"`
	Currency string `json:"currency" bson:"currency"`

	CreateAt int64 `json:"create_at" bson:"create_at"`

	SubscribeID       string `json:"subscribe_id"`
	CreateAtSubscribe int64  `json:"create_at_subscribe"`
}

PortalUserAccountShort for short represent account

type PortalUserHotelVoucher

type PortalUserHotelVoucher struct {
	ID string `json:"id" bson:"_id"`

	Account string `json:"account" bson:"account"`
	Profile string `json:"profile" bson:"profile"`

	Create   time.Time `json:"create" bson:"create"`
	CreateAt int64     `json:"create_at" bson:"create_at"`

	StartAt  int64 `json:"start_at" bson:"start_at"`
	ExpireAt int64 `json:"expire_at" bson:"expire_at"`

	Code string `json:"code" bson:"code"`
	Used bool   `json:"used" bson:"used"`

	// limits
	SpeedLimit   int   `json:"speed" bson:"speed"`
	TimeoutLimit int64 `json:"session" bson:"session"`
	TrafficLimit int   `json:"traffic" bson:"traffic"`
}

PortalUserHotelVoucher struct to represent voucher

type PortalUserState

type PortalUserState string
const PortalUserStateAdvertise PortalUserState = "advertise"
const PortalUserStateAuthenticate PortalUserState = "authenticate"
const PortalUserStateAuthorize PortalUserState = "authorize"
const PortalUserStateNew PortalUserState = "new"
const PortalUserStatePass PortalUserState = "pass"

func (*PortalUserState) GetBSON

func (en *PortalUserState) GetBSON() (interface{}, error)

func (PortalUserState) GetPtr

func (en PortalUserState) GetPtr() *PortalUserState

func (*PortalUserState) MarshalJSON

func (en *PortalUserState) MarshalJSON() ([]byte, error)

func (*PortalUserState) SetBSON

func (en *PortalUserState) SetBSON(v bson.Raw) error

func (PortalUserState) String

func (en PortalUserState) String() string

func (*PortalUserState) UnmarshalJSON

func (en *PortalUserState) UnmarshalJSON(b []byte) error

type PortalUserVoucher

type PortalUserVoucher struct {
	ID string `json:"id" bson:"_id"`

	Account string `json:"account" bson:"account"`
	Profile string `json:"profile" bson:"profile"`

	Create   time.Time `json:"create" bson:"create"`
	CreateAt int64     `json:"create_at" bson:"create_at"`

	StartAt  int64 `json:"start_at" bson:"start_at"`
	ExpireAt int64 `json:"expire_at" bson:"expire_at"`

	Code string `json:"code" bson:"code"`
	Used bool   `json:"used" bson:"used"`

	Identity string `json:"identity" bson:"identity"`

	// limits
	SpeedLimit   int   `json:"speed" bson:"speed"`
	TimeoutLimit int64 `json:"session" bson:"session"`
	TrafficLimit int   `json:"traffic" bson:"traffic"`

	// not needed anymore
	Plan string `json:"tariff" bson:"tariff"`
}

PortalUserVoucher struct to represent voucher

type RadAccessRequest

type RadAccessRequest struct {
	NASIdentifier string `json:"NAS-Identifier"`
	NASIPAddress  string `json:"NAS-IP-Address"`
	NASPortId     string `json:"NAS-Port-Id"`
	NASPort       string `json:"NAS-Port"`
	NASPortType   string `json:"NAS-Port-Type"`

	UserName         string `json:"User-Name"`
	CHAPPassword     string `json:"CHAP-Password"`
	CHAPChallenge    string `json:"CHAP-Challenge"`
	FramedIPAddress  string `json:"Framed-IP-Address"`
	WISPrLocationID  string `json:"WISPr-Location-ID"`
	WISPrLogoffURL   string `json:"WISPr-Logoff-URL"`
	CalledStationId  string `json:"Called-Station-Id"`
	CallingStationId string `json:"Calling-Station-Id"`
	AcctSessionId    string `json:"Acct-Session-Id"`

	ServiceType          string `json:"Service-Type"`
	MessageAuthenticator string `json:"Message-Authenticator"`
	EventTimestamp       string `json:"Event-Timestamp"`
	ChilliSpotVersion    string `json:"ChilliSpot-Version"`
}

type RadAccessResponce

type RadAccessResponce struct {
	Code  int         `json:"Code"`
	Reply []MapEntity `json:"Reply-Message,omitempty"`
}

type RadAccounting

type RadAccounting struct {
	RadAcctRequest
	Create time.Time `json:"create" bson:"create"`
	ID     string    `json:"id" bson:"_id"`
}

type RadAcctRequest

type RadAcctRequest struct {
	CalledStationId  string `json:"Called-Station-Id"`
	CallingStationId string `json:"Calling-Station-Id"`
	EventTimestamp   string `json:"Event-Timestamp"`

	NASIdentifier string `json:"NAS-Identifier"`
	NASIPAddress  string `json:"NAS-IP-Address"`
	NASPortType   string `json:"NAS-Port-Type"`

	AcctStatusType      string `json:"Acct-Status-Type"`
	AcctTerminateCause  string `json:"Acct-Terminate-Cause,omitempty"`
	AcctSessionID       string `json:"Acct-Session-ID"`
	AcctDelayTime       string `json:"Acct-Delay-Time"`
	AcctInputGigawords  string `json:"Acct-Input-Gigawords"`
	AcctOutputGigawords string `json:"Acct-Output-Gigawords"`
	AcctOutputOctets    string `json:"Acct-Output-Octets"`
	AcctInputOctets     string `json:"Acct-Input-Octets"`
	AcctInputPackets    string `json:"Acct-Input-Packets"`
	AcctOutputPackets   string `json:"Acct-Output-Packets"`
	AcctSessionTime     string `json:"Acct-Session-Time"`

	Attr261455910     string `json:"Attr-26.14559.10"`
	ChilliSpotVersion string `json:"ChilliSpot-Version"`
	WISPrLocationID   string `json:"WISPr-Location-ID"`
}

type RadAcctResponse

type RadAcctResponse RadAccessResponce

type RadCoARequest

type RadCoARequest struct {
	UserName        string `json:"User-Name"`
	AcctSessionId   string `json:"Acct-Session-Id"`
	FramedIPAddress string `json:"Framed-IP-Address"`

	SessionTimeout int `json:"Session-Timeout"`
	IdleTimeout    int `json:"Idle-Timeout"`
}

type Schedule

type Schedule struct {
	// only for ADvertisement
	Views int `json:"views" bson:"views"`

	// range of schedule
	Start int64 `json:"start" bson:"start"`
	Stop  int64 `json:"stop" bson:"stop"`

	// diff with UTC (+4 or -3)
	UTCDiff int `json:"utc_diff" bson:"utc_diff"`

	// day Of week mask (1 << ct.Weekday()!)
	// example: 1 << 0 && 1 << 6 for Sunday && Saturday (or yeah, Sunday FIRST)
	DoWMask int `json:"dow_mask" bson:"dow_mask"`

	// hour of day mask (1 << ct.Hour()!)
	// example: HourMask = 1 << 0 + 1 << 1 for 0-1 and 1-2 hours
	HourMask int `json:"hour_mask" bson:"hour_mask"`

	// old time of day format
	TimeOfDay struct {
		Morning   bool `json:"morning,omitempty" bson:"morning"`
		Afternoon bool `json:"afternoon,omitempty" bson:"afternoon"`
		Evening   bool `json:"evening,omitempty" bson:"evening"`
		Night     bool `json:"night,omitempty" bson:"night"`
	} `json:"time_of_day,omitempty" bson:"time_of_day"`

	// old day of week format
	DayOfWeek struct {
		Monday    bool `json:"monday,omitempty" bson:"monday"`
		Tuesday   bool `json:"tuesday,omitempty" bson:"tuesday"`
		Wednesday bool `json:"wednesday,omitempty" bson:"wednesday"`
		Thursday  bool `json:"thursday,omitempty" bson:"thursday"`
		Friday    bool `json:"friday,omitempty" bson:"friday"`
		Saturday  bool `json:"saturday,omitempty" bson:"saturday"`
		Sunday    bool `json:"sunday,omitempty" bson:"sunday"`
	} `json:"day_of_week,omitempty" bson:"day_of_week"`
}

Schedule

func (*Schedule) At

func (s *Schedule) At(ct int64) bool

At method to check is ct at schedule or not

type TariffPlanType added in v1.7.0

type TariffPlanType string
const TariffPlanTypeSubscription TariffPlanType = "subscription"
const TariffPlanTypeVoucher TariffPlanType = "voucher"

func (*TariffPlanType) GetBSON added in v1.7.0

func (en *TariffPlanType) GetBSON() (interface{}, error)

func (TariffPlanType) GetPtr added in v1.7.0

func (en TariffPlanType) GetPtr() *TariffPlanType

func (*TariffPlanType) MarshalJSON added in v1.7.0

func (en *TariffPlanType) MarshalJSON() ([]byte, error)

func (*TariffPlanType) SetBSON added in v1.7.0

func (en *TariffPlanType) SetBSON(v bson.Raw) error

func (TariffPlanType) String added in v1.7.0

func (en TariffPlanType) String() string

func (*TariffPlanType) UnmarshalJSON added in v1.7.0

func (en *TariffPlanType) UnmarshalJSON(b []byte) error

type UserAgent

type UserAgent struct {
	Type      string `json:"type" bson:"type"`
	Device    string `json:"device" bson:"device"`
	Name      string `json:"name" bson:"name"`
	OS        string `json:"os" bson:"os"`
	OSVersion string `json:"os_version" bson:"os_version"`
}

UserAgent struct for parse useragent to internal struct

func NewUserAgent

func NewUserAgent(useragent string) UserAgent

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL