diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-05-22 17:36:34 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-05-22 17:36:34 +0300 |
| commit | 769590d77993d8c26bfb9d056cb94d870cf6c745 (patch) | |
| tree | fb876b5b9d7eef99e814ebd9be94de8046334e3c /web/service/inbound.go | |
| parent | 1fa9101b405ad1ba0127317ea4f8a151048b97ee (diff) | |
[feature] separate subscription service
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/service/inbound.go')
| -rw-r--r-- | web/service/inbound.go | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/web/service/inbound.go b/web/service/inbound.go index 57df0b9e..6a182fcf 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -51,7 +51,7 @@ func (s *InboundService) checkPortExist(port int, ignoreId int) (bool, error) { return count > 0, nil } -func (s *InboundService) getClients(inbound *model.Inbound) ([]model.Client, error) { +func (s *InboundService) GetClients(inbound *model.Inbound) ([]model.Client, error) { settings := map[string][]model.Client{} json.Unmarshal([]byte(inbound.Settings), &settings) if settings == nil { @@ -110,7 +110,7 @@ func (s *InboundService) checkEmailsExistForClients(clients []model.Client) (str } func (s *InboundService) checkEmailExistForInbound(inbound *model.Inbound) (string, error) { - clients, err := s.getClients(inbound) + clients, err := s.GetClients(inbound) if err != nil { return "", err } @@ -150,7 +150,7 @@ func (s *InboundService) AddInbound(inbound *model.Inbound) (*model.Inbound, err return inbound, common.NewError("Duplicate email:", existEmail) } - clients, err := s.getClients(inbound) + clients, err := s.GetClients(inbound) if err != nil { return inbound, err } @@ -208,7 +208,7 @@ func (s *InboundService) DelInbound(id int) error { if err != nil { return err } - clients, err := s.getClients(inbound) + clients, err := s.GetClients(inbound) if err != nil { return err } @@ -263,7 +263,7 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound, } func (s *InboundService) AddInboundClient(data *model.Inbound) error { - clients, err := s.getClients(data) + clients, err := s.GetClients(data) if err != nil { return err } @@ -372,7 +372,7 @@ func (s *InboundService) DelInboundClient(inboundId int, clientId string) error } func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId string) error { - clients, err := s.getClients(data) + clients, err := s.GetClients(data) if err != nil { return err } @@ -390,7 +390,7 @@ func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId strin return err } - oldClients, err := s.getClients(oldInbound) + oldClients, err := s.GetClients(oldInbound) if err != nil { return err } @@ -712,7 +712,7 @@ func (s *InboundService) GetClientByEmail(clientEmail string) (*xray.ClientTraff return nil, nil, common.NewError("Inbound Not Found For Email:", clientEmail) } - clients, err := s.getClients(inbound) + clients, err := s.GetClients(inbound) if err != nil { return nil, nil, err } @@ -737,7 +737,7 @@ func (s *InboundService) SetClientTelegramUserID(trafficId int, tgId string) err clientEmail := traffic.Email - oldClients, err := s.getClients(inbound) + oldClients, err := s.GetClients(inbound) if err != nil { return err } @@ -791,7 +791,7 @@ func (s *InboundService) ToggleClientEnableByEmail(clientEmail string) (bool, er return false, common.NewError("Inbound Not Found For Email:", clientEmail) } - oldClients, err := s.getClients(inbound) + oldClients, err := s.GetClients(inbound) if err != nil { return false, err } @@ -847,7 +847,7 @@ func (s *InboundService) ResetClientIpLimitByEmail(clientEmail string, count int return common.NewError("Inbound Not Found For Email:", clientEmail) } - oldClients, err := s.getClients(inbound) + oldClients, err := s.GetClients(inbound) if err != nil { return err } @@ -901,7 +901,7 @@ func (s *InboundService) ResetClientExpiryTimeByEmail(clientEmail string, expiry return common.NewError("Inbound Not Found For Email:", clientEmail) } - oldClients, err := s.getClients(inbound) + oldClients, err := s.GetClients(inbound) if err != nil { return err } @@ -1100,7 +1100,7 @@ func (s *InboundService) GetClientTrafficTgBot(tguname string) ([]*xray.ClientTr } var emails []string for _, inbound := range inbounds { - clients, err := s.getClients(inbound) + clients, err := s.GetClients(inbound) if err != nil { logger.Error("Unable to get clients from inbound") } @@ -1250,7 +1250,7 @@ func (s *InboundService) MigrationRequirements() { inbounds[inbound_index].Settings = string(modifiedSettings) } // Add client traffic row for all clients which has email - modelClients, err := s.getClients(inbounds[inbound_index]) + modelClients, err := s.GetClients(inbounds[inbound_index]) if err != nil { return } |
